forked from CrossNox/m2r2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
67 lines (53 loc) · 1.61 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
"""Entrypoint for nox."""
import tempfile
import nox
@nox.session(
reuse_venv=True,
python=[
"2.7",
"3.4",
"3.5",
"3.6",
"3.7",
"3.8",
"3.9",
"3.10",
"3.10.0-beta.4",
"pypy",
"pypy3",
],
)
def tests(session):
"""Run all tests."""
session.install(".")
session.install("-r", "./requirements-test.txt")
cmd = ["pytest"]
if session.posargs:
cmd.extend(session.posargs)
session.run(*cmd)
@nox.session(reuse_venv=True, python="3.7")
def cop(session):
"""Run all pre-commit hooks."""
session.install(".")
session.install("-r", "requirements-dev.txt")
session.run("pre-commit", "install")
session.run("pre-commit", "run", "--show-diff-on-failure", "--all-files")
@nox.session(reuse_venv=True, python="3.7")
def bandit(session):
"""Run bandit."""
session.install("bandit")
session.run("bandit", "-r", "m2r2.py", "-ll", "-c", "bandit.yaml")
@nox.session(reuse_venv=True, python="3.7")
def test_sphinx_old_build(session):
"""Build docs with sphinx."""
with tempfile.TemporaryDirectory() as tmpdirname:
session.install(".")
session.install("sphinx==1.7.0")
session.run("sphinx-build", "-W", "-E", "-n", "-b", "html", "docs", tmpdirname)
@nox.session(reuse_venv=True, python="3.7")
def test_sphinx_build(session):
"""Build docs with sphinx."""
with tempfile.TemporaryDirectory() as tmpdirname:
session.install(".")
session.install("sphinx")
session.run("sphinx-build", "-W", "-E", "-n", "-b", "html", "docs", tmpdirname)