-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
noxfile.py
102 lines (86 loc) · 2.31 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
import os
from pathlib import Path
import nox
from nox_poetry import session
nox.options.sessions = ["test", "coverage", "mypy"] # "docs"]
python_versions = ["3.8", "3.9", "3.10", "3.11", "3.12"]
@session(python="python3.10")
def coverage(session):
session.install("coverage[toml]")
session.env["TOP"] = str(Path(__file__).parent)
try:
session.run("coverage", "combine")
except:
pass
session.run("coverage", "html")
session.run("coverage", "report", "--fail-under", "100")
session.run("coverage", "erase")
@session(python=python_versions)
def mypy(session):
session.install("mypy", "pytest", "hypothesis", "dirty-equals", ".")
args = ["inline_snapshot", "tests"]
if session.posargs:
args = session.posargs
session.run("mypy", *args)
@session(python=python_versions)
def test(session):
session.install(
".",
"pytest",
"hypothesis",
"pytest-subtests",
"pytest",
"coverage",
"pytest-xdist",
"coverage-enable-subprocess",
"dirty-equals",
"time-machine",
"mypy",
"pyright",
)
cmd = []
if (
session.python in (python_versions[0], python_versions[-1])
or "CI" in os.environ
):
cmd += ["coverage", "run", "-m"]
session.env["COVERAGE_PROCESS_START"] = str(
Path(__file__).parent / "pyproject.toml"
)
session.env["TOP"] = str(Path(__file__).parent)
else:
cmd = ["python", "-m"]
args = [] if session.posargs else ["-n", "auto", "-v"]
session.run(
*cmd,
"pytest",
"--doctest-modules",
*args,
"tests",
"inline_snapshot",
*session.posargs
)
@session(python="python3.10")
def mkdocs(session):
session.install(
"mkdocs",
"mkdocs-material[imaging]",
"mkdocstrings[python]",
"markdown-exec[ansi]",
"docs/plugins",
"pytest",
".",
)
session.run("mkdocs", *session.posargs)
@session(python="python3.10")
def docs_serve(session):
session.install(
"mkdocs",
"mkdocs-material[imaging]",
"mkdocstrings[python]",
"markdown-exec[ansi]",
"docs/plugins",
"pytest",
".",
)
session.run("mkdocs", "serve", *session.posargs)