-
Notifications
You must be signed in to change notification settings - Fork 1
/
noxfile.py
49 lines (34 loc) · 1.44 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
from nox import options, parametrize
from nox_poetry import Session, session
options.sessions = ["test", "test_taco", "test_numpy", "coverage", "lint"]
@session(python=["3.10", "3.11", "3.12"])
def test(s: Session):
s.install(".", "pytest", "pytest-cov")
s.env["COVERAGE_FILE"] = f".coverage.{s.python}"
s.run("python", "-m", "pytest", "--cov", "tensora", "tests")
@session(python=["3.10", "3.11", "3.12"])
def test_taco(s: Session):
s.install(".[taco]", "pytest", "pytest-cov")
s.env["COVERAGE_FILE"] = f".coverage.taco.{s.python}"
s.run("python", "-m", "pytest", "--cov", "tensora", "tests/taco")
@session(python=["3.10", "3.11", "3.12"])
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", "tensora", "tests/test_numpy.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")
def fuzz(s: Session):
s.run("hypothesis", "fuzz", "fuzz_tests")
@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", ".")