forked from Pylons/acidfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
91 lines (71 loc) · 2.08 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
"""Build and test configuration file. """
import os
import shutil
import nox
NOX_DIR = os.path.abspath(os.path.dirname(__file__))
DEFAULT_INTERPRETER = "3.9"
ALL_INTERPRETERS = ("3.6", "3.7", "3.8", "3.9")
def get_path(*names):
return os.path.join(NOX_DIR, *names)
@nox.session(py=ALL_INTERPRETERS)
def unit(session):
# Install all dependencies.
session.install("-e", ".[testing]")
# Run py.test against the unit tests.
run_args = ["pytest"]
if session.posargs:
run_args.extend(session.posargs)
else:
run_args.extend(
[
"--cov=acidfs",
"--cov=tests",
"--cov-report=term-missing",
]
)
run_args.append(get_path("tests.py"))
session.run(*run_args)
def run_black(session, use_check=False):
args = ["black"]
if use_check:
args.append("--check")
args.extend(
[
get_path("noxfile.py"),
get_path("setup.py"),
get_path("acidfs"),
get_path("tests.py"),
]
)
session.run(*args)
@nox.session(py=DEFAULT_INTERPRETER)
def lint(session):
"""Run linters.
Returns a failure if the linters find linting errors or sufficiently
serious code quality issues.
"""
session.install("flake8", "black")
run_black(session, use_check=True)
session.run("flake8", "acidfs", "tests.py", "setup.py")
@nox.session(py=DEFAULT_INTERPRETER)
def blacken(session):
# Install all dependencies.
session.install("black")
# Run ``black``.
run_black(session)
@nox.session(py=DEFAULT_INTERPRETER)
def docs(session):
"""Build the docs for this library."""
session.install("-e", ".[docs]")
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
session.run(
"sphinx-build",
"-W", # warnings as errors
"-T", # show full traceback on exception
"-b",
"html",
"-d",
os.path.join("docs", "_build", "doctrees", ""),
os.path.join("docs", ""),
os.path.join("docs", "_build", "html", ""),
)