-
Notifications
You must be signed in to change notification settings - Fork 5
/
noxfile.py
37 lines (25 loc) · 1.02 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
from __future__ import annotations
from nox import options, parametrize
from nox_poetry import Session, session
options.sessions = ["test", "coverage", "lint", "type_check"]
@session(python=["3.9", "3.10", "3.11", "3.12", "3.13"])
def test(s: Session):
s.install(".", "pytest", "pytest-cov", "pytest-timeout")
s.env["COVERAGE_FILE"] = f".coverage.{s.python}"
s.run("python", "-m", "pytest", "--cov", "parsita")
@session(venv_backend="none")
def coverage(s: Session):
s.run("coverage", "combine")
s.run("coverage", "html")
s.run("coverage", "xml", "--fail-under=100")
@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 type_check(s: Session):
s.run("mypy", "src", "examples")
@session(venv_backend="none")
def format(s: Session):
s.run("ruff", "check", ".", "--select", "I", "--select", "RUF022", "--fix")
s.run("ruff", "format", ".")