-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoxfile.py
40 lines (32 loc) · 1.01 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
import nox # type: ignore
nox.options.sessions = [
"tests",
"lint",
]
python = [
"3.9",
"3.10",
"3.11",
"3.12",
"3.13",
]
@nox.session(python=python)
def tests(session: nox.Session):
"""Run pytest + code coverage."""
session.run("poetry", "install", external=True)
session.run("pytest", "--cov-report", "term-missing", "--cov=src")
@nox.session(reuse_venv=True, name="format")
def format_all(session: nox.Session):
"""Format codebase with ruff."""
session.run("poetry", "install", "--only", "dev", external=True)
session.run("ruff", "format")
# format imports according to isort via ruff check
session.run("ruff", "check", "--select", "I", "--fix")
@nox.session(reuse_venv=True)
def lint(session: nox.Session):
"""Run ruff linter."""
session.run("poetry", "install", "--only", "dev", external=True)
# Run the ruff linter
session.run("ruff", "check")
# Check if any code requires formatting via ruff format
session.run("ruff", "format", "--diff")