-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnoxfile.py
More file actions
42 lines (34 loc) · 1.34 KB
/
noxfile.py
File metadata and controls
42 lines (34 loc) · 1.34 KB
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
"""Nox sessions for AGON."""
import nox
PYTHON_VERSIONS = ["3.11", "3.12", "3.13"]
LOCATIONS = ["python", "tests"]
@nox.session(python=PYTHON_VERSIONS[-1])
def lint(session: nox.Session) -> None:
"""Run linting and type checking."""
# Install the project and runtime deps so type checking can resolve imports.
session.install(".")
session.install("ruff", "basedpyright", "codespell")
session.run("ruff", "check", *LOCATIONS)
session.run("ruff", "format", "--check", *LOCATIONS)
session.run("basedpyright", "python")
session.run("codespell", "python", "tests")
@nox.session(python=PYTHON_VERSIONS)
def unit(session: nox.Session) -> None:
"""Run unit tests."""
session.install(".", "pytest", "pytest-cov", "pytest-sugar", "pytest-xdist", "tiktoken")
session.run(
"pytest",
"--cov=agon",
"--cov-report=term-missing",
*session.posargs,
)
@nox.session(python=PYTHON_VERSIONS[-1])
def coverage(session: nox.Session) -> None:
"""Generate coverage report."""
session.install("coverage[toml]")
# Combine coverage data and apply path mappings
session.run("coverage", "combine", "--keep", success_codes=[0, 1])
if session.posargs and session.posargs[0] == "xml":
session.run("coverage", "xml")
else:
session.run("coverage", "report", "--show-missing")