-
Notifications
You must be signed in to change notification settings - Fork 183
/
noxfile.py
49 lines (34 loc) · 1.46 KB
/
noxfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import nox
# DJANGO_STABLE_VERSION should be set to the latest Django LTS version
# and should *not* appear in DJANGO_VERSIONS
DJANGO_STABLE_VERSION = "4.2"
DJANGO_VERSIONS = ["4.2", "5.0", "5.1", "main"]
# PYTHON_STABLE_VERSION should be set to the latest stable Python version
# and should *not* appear in PYTHON_VERSIONS
PYTHON_STABLE_VERSION = "3.11"
PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12"]
nox.options.default_venv_backend = "uv|venv"
nox.options.reuse_existing_virtualenvs = True
@nox.session
def lint(session):
session.install(".[lint]")
session.run("python", "-m", "pre_commit", "run", "--all-files")
@nox.session(python=[PYTHON_STABLE_VERSION], tags=["django"])
@nox.parametrize("django", DJANGO_VERSIONS)
def test_django_version(session: nox.Session, django: str) -> None:
if django == DJANGO_STABLE_VERSION:
session.skip()
session.install(".[test]")
if django == "main":
session.install("https://github.com/django/django/archive/refs/heads/main.zip")
else:
session.install(f"django~={django}.0")
session.run("pytest", *session.posargs)
@nox.session(python=PYTHON_VERSIONS, tags=["python"])
@nox.parametrize("django", [DJANGO_STABLE_VERSION])
def test_python_version(session: nox.Session, django: str) -> None:
if session.python == PYTHON_STABLE_VERSION:
session.skip()
session.install(".[test]")
session.install(f"django~={django}.0")
session.run("pytest", *session.posargs)