-
Notifications
You must be signed in to change notification settings - Fork 2
/
noxfile.py
53 lines (38 loc) · 1.72 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
50
51
52
53
from nox import options, parametrize
from nox_poetry import Session, session
options.sessions = ["test", "test_fastapi", "test_numpy", "test_ordered_set", "coverage", "lint"]
@session(python=["3.10", "3.11", "3.12", "3.13"])
def test(s: Session):
s.install(".", "pytest", "pytest-cov")
s.env["COVERAGE_FILE"] = f".coverage.{s.python}"
s.run("python", "-m", "pytest", "--cov", "serialite")
@session(python=["3.10", "3.11", "3.12", "3.13"])
def test_fastapi(s: Session):
s.install(".[fastapi]", "pytest", "pytest-cov", "httpx")
s.env["COVERAGE_FILE"] = f".coverage.fastapi.{s.python}"
s.run("python", "-m", "pytest", "--cov", "serialite", "tests/fastapi")
@session(python=["3.10", "3.11", "3.12", "3.13"])
def test_numpy(s: Session):
s.install(".[numpy]", "pytest", "pytest-cov")
s.env["COVERAGE_FILE"] = f".coverage.numpy.{s.python}"
s.run("python", "-m", "pytest", "--cov", "serialite", "tests/test_numpy.py")
@session(python=["3.10", "3.11", "3.12", "3.13"])
def test_ordered_set(s: Session):
s.install(".[ordered-set]", "pytest", "pytest-cov")
s.env["COVERAGE_FILE"] = f".coverage.ordered_set.{s.python}"
s.run(
"python", "-m", "pytest", "--cov", "serialite", "tests/implementations/test_ordered_set.py"
)
@session(venv_backend="none")
def coverage(s: Session):
s.run("coverage", "combine")
s.run("coverage", "html")
s.run("coverage", "xml")
@session(venv_backend="none")
@parametrize("command", [["ruff", "check", "."], ["ruff", "format", "--check", "."]])
def lint(s: Session, command: list[str]):
s.run(*command)
@session(venv_backend="none")
def format(s: Session) -> None:
s.run("ruff", "check", ".", "--select", "I", "--fix")
s.run("ruff", "format", ".")