-
Notifications
You must be signed in to change notification settings - Fork 19
/
noxfile.py
110 lines (92 loc) · 2.32 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import nox
nox.options.sessions = [
"style",
"lints",
"tests",
]
SOURCES = (
"noxfile.py",
"paleomix",
"tests",
"typings",
)
class Requirements:
COVERAGE = "coverage[toml]~=7.3"
NOX = "nox~=2024.3.2"
PYRIGHT = "basedpyright==1.10.3"
PYTEST = "pytest~=7.4"
PYTEST_COV = "pytest-cov~=4.1"
RUFF = "ruff==0.4.1"
@nox.session
def style(session: nox.Session) -> None:
session.install(Requirements.RUFF)
# Replaces `black --check`
session.run("ruff", "format", "--check", *SOURCES)
# Replaces `isort --check-only`
session.run("ruff", "check", "--select", "I", *SOURCES)
@nox.session
def lints(session: nox.Session) -> None:
session.install(Requirements.RUFF)
session.run("ruff", "check", *SOURCES)
@nox.session()
def typing(session: nox.Session) -> None:
session.install(
".",
Requirements.PYTEST,
Requirements.NOX,
Requirements.PYRIGHT,
)
session.run("basedpyright", *SOURCES)
@nox.session()
def tests(session: nox.Session) -> None:
session.install(
"-e",
".",
Requirements.PYTEST,
Requirements.COVERAGE,
Requirements.PYTEST_COV,
)
session.run(
"python3",
# Run tests in development mode (enables extra checks)
"-X",
"dev",
"-m",
"pytest",
"tests",
"--cov",
"paleomix",
"--cov",
"tests",
"--cov-report=xml",
"--cov-report=term-missing",
"--no-cov-on-fail",
# Exclude slow tests, including tests that run the pipeline via subprocess
"-m",
"not slow",
"--quiet",
# Treat warnings (deprections, etc.) as errors
"-Werror",
# Re-run failed tests, or all tests if there were no failures
"--last-failed",
"--last-failed-no-failures",
"all",
)
@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"])
def full_tests(session: nox.Session) -> None:
session.install(
".",
Requirements.PYTEST,
)
session.run(
"python3",
# Run tests in development mode (enables extra checks)
"-X",
"dev",
"-m",
"pytest",
"tests",
"--quiet",
# Treat warnings (deprections, etc.) as errors
"-Werror",
)