-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
noxfile.py
60 lines (44 loc) · 1.74 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
from pathlib import Path
import nox
nox.options.sessions = ["clean", "test", "report", "mypy"]
nox.options.reuse_existing_virtualenvs = True
python_version = ["3.8", "3.9", "3.10", "3.11", "3.12"]
@nox.session(python="python3.10")
def clean(session):
session.run_always("poetry", "install", "--with=dev", external=True)
session.env["TOP"] = str(Path(__file__).parent)
session.run("coverage", "erase")
@nox.session(python=python_version)
def mypy(session):
session.install("poetry")
session.run("poetry", "install", "--with=dev")
if Path("../pysource-minimize/").exists():
session.install("../pysource-minimize/")
session.run("mypy", "pysource_minimize", "tests")
@nox.session(python=python_version)
def test(session):
session.run_always("poetry", "install", "--with=dev", external=True)
session.env["COVERAGE_PROCESS_START"] = str(
Path(__file__).parent / "pyproject.toml"
)
session.env["TOP"] = str(Path(__file__).parent)
args = [] if session.posargs else ["-n", "auto", "-v"]
session.install("attrs") # some bug with pytest-subtests
if Path("../pysource-minimize/").exists():
session.install("../pysource-minimize/")
session.run("pytest", *args, "tests", *session.posargs)
@nox.session(python="python3.10")
def report(session):
session.run_always("poetry", "install", "--with=dev", external=True)
session.env["TOP"] = str(Path(__file__).parent)
try:
session.run("coverage", "combine")
except:
pass
session.run("coverage", "html")
session.run("coverage", "report")
# @nox.session(python="python3.10")
# def docs(session):
# session.install("poetry")
# session.run("poetry", "install", "--with=doc")
# session.run("mkdocs", "build")