-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoxfile.py
51 lines (41 loc) · 1.4 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
"""Nox sessions."""
import platform
from nox import options
from nox_poetry import Session, session
options.sessions = ["tests", "mypy"]
python_versions = ["3.10"]
@session(python=python_versions)
def tests(session: Session) -> None:
"""Run the test suite."""
dependencies = ["invoke", "pytest", "xdoctest", "coverage[toml]", "pytest-cov"]
session.install(".", *dependencies)
try:
session.run(
"inv",
"tests",
env={
"COVERAGE_FILE": f".coverage.{platform.system()}.{platform.python_version()}",
},
)
finally:
if session.interactive:
session.notify("coverage")
@session
def coverage(session: Session) -> None:
"""Produce the coverage report."""
args = session.posargs if session.posargs and len(session._runner.manifest) == 1 else []
dependencies = ["invoke", "coverage[toml]"]
session.install(*dependencies)
session.run("inv", "coverage", *args)
@session(python=python_versions)
def mypy(session: Session) -> None:
"""Type-check using mypy."""
dependencies = ["invoke", "mypy"]
session.install(".", *dependencies)
session.run("inv", "mypy")
@session(python=python_versions)
def safety(session: Session) -> None:
"""Scan dependencies for insecure packages."""
dependencies = ["invoke", "safety"]
session.install(*dependencies)
session.run("inv", "safety")