Skip to content

Commit eeae1d5

Browse files
committed
Minor noxfile tweaking.
1 parent 4bb56c2 commit eeae1d5

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

noxfile.py

+16-6
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,35 @@
99
DOCS = ROOT / "docs"
1010
REFERENCING = ROOT / "referencing"
1111

12+
REQUIREMENTS = dict(
13+
docs=DOCS / "requirements.txt",
14+
tests=ROOT / "test-requirements.txt",
15+
)
16+
REQUIREMENTS_IN = [ # this is actually ordered, as files depend on each other
17+
path.parent / f"{path.stem}.in" for path in REQUIREMENTS.values()
18+
]
19+
20+
SUPPORTED = ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.10"]
21+
LATEST = "3.12"
1222

1323
nox.options.sessions = []
1424

1525

16-
def session(default=True, **kwargs): # noqa: D103
26+
def session(default=True, python=LATEST, **kwargs): # noqa: D103
1727
def _session(fn):
1828
if default:
1929
nox.options.sessions.append(kwargs.get("name", fn.__name__))
20-
return nox.session(**kwargs)(fn)
30+
return nox.session(python=python, **kwargs)(fn)
2131

2232
return _session
2333

2434

25-
@session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3"])
35+
@session(python=SUPPORTED)
2636
def tests(session):
2737
"""
2838
Run the test suite with a corresponding Python version.
2939
"""
30-
session.install("-r", ROOT / "test-requirements.txt")
40+
session.install("-r", REQUIREMENTS["tests"])
3141

3242
if session.posargs and session.posargs[0] == "coverage":
3343
if len(session.posargs) > 1 and session.posargs[1] == "github":
@@ -109,7 +119,7 @@ def docs(session, builder):
109119
"""
110120
Build the documentation using a specific Sphinx builder.
111121
"""
112-
session.install("-r", DOCS / "requirements.txt")
122+
session.install("-r", REQUIREMENTS["docs"])
113123
with TemporaryDirectory() as tmpdir_str:
114124
tmpdir = Path(tmpdir_str)
115125
argv = ["-n", "-T", "-W"]
@@ -147,7 +157,7 @@ def requirements(session):
147157
Update the project's pinned requirements. Commit the result.
148158
"""
149159
session.install("pip-tools")
150-
for each in [DOCS / "requirements.in", ROOT / "test-requirements.in"]:
160+
for each in REQUIREMENTS_IN:
151161
session.run(
152162
"pip-compile",
153163
"--resolver",

0 commit comments

Comments
 (0)