-
Notifications
You must be signed in to change notification settings - Fork 7
/
noxfile.py
65 lines (57 loc) · 1.42 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
import os.path
import nox
test_reqs = ["pytest", "pytest-cov", "coverage"]
pytest_cov_args = ["--cov=find_libpython", "--cov-branch"]
coverage_file = "coverage.xml"
@nox.session
def tests(session):
# install current module and runtime dependencies
session.install(".")
# install testing dependencies
session.install(*test_reqs)
# print info
session.run(
"python",
"-m",
"coverage",
"run",
"-m",
"find_libpython",
"-v",
"--platform-info",
)
session.run(
"python",
"-m",
"coverage",
"run",
"-m",
"find_libpython",
"-v",
"--candidate-names",
)
session.run(
"python",
"-m",
"coverage",
"run",
"-m",
"find_libpython",
"-v",
"--candidate-paths",
)
session.run("python", "-m", "coverage", "run", "-m", "find_libpython", "-v")
# run pytest
install_loc = session.run(
"python",
"-c",
"import find_libpython; print(find_libpython.__file__)",
silent=True,
)
install_loc = os.path.dirname(install_loc.strip())
session.run("pytest", *pytest_cov_args, "tests/")
session.run(
"pytest", *pytest_cov_args, "--cov-append", "--doctest-modules", install_loc
)
# create coverage report for upload
session.run("coverage", "xml", "-o", coverage_file)