forked from useblocks/sphinx-test-reports
-
Notifications
You must be signed in to change notification settings - Fork 1
/
noxfile.py
53 lines (41 loc) · 1.43 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
import nox
from nox import session
PYTHON_VERSIONS = ["3.8", "3.9", "3.10"]
SPHINX_VERSIONS = ["5.0", "6.2.1", "7.1.2", "7.2.5"]
TEST_DEPENDENCIES = [
"pytest",
"pytest-xdist",
]
LINT_DEPENDENCIES = [
"flake8",
"pep8-naming",
"flake8-isort",
"flake8-black",
]
def is_supported(python: str, sphinx: str) -> bool:
return not (python == "3.6" and float(sphinx) > 3.0) # fmt: skip
def run_tests(session, sphinx):
session.install(".")
session.install(*TEST_DEPENDENCIES)
session.run("pip", "install", f"sphinx=={sphinx}", silent=True)
session.run("pip", "install", "-r", "doc-requirements.txt", silent=True)
session.run("make", "test", external=True)
@session(python=PYTHON_VERSIONS)
@nox.parametrize("sphinx", SPHINX_VERSIONS)
def tests(session, sphinx):
if is_supported(session.python, sphinx):
run_tests(session, sphinx)
else:
session.skip("unsupported combination")
@session(python="3.9")
def lint(session):
session.install(*LINT_DEPENDENCIES)
session.run("make", "lint", external=True)
@session(python="3.9")
def linkcheck(session):
session.install(".")
# LinkCheck cn handle rate limits since Sphinx 3.4, which is needed as
# our doc has to many links to GitHub.
session.run("pip", "install", "sphinx==3.5.4", silent=True)
session.run("pip", "install", "-r", "doc-requirements.txt", silent=True)
session.run("make", "docs-linkcheck", external=True)