-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtox.ini
132 lines (125 loc) · 4.92 KB
/
tox.ini
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# SPDX-FileCopyrightText: 2023 Ross Patterson <[email protected]>
#
# SPDX-License-Identifier: MIT
[tox]
# https://devguide.python.org/versions/#supported-versions
envlist = py{311,312,310,39,38}
[project]
name = prunerr
package = prunerr
[testenv]
description = Run the project test suite
package = editable
package_env = .pkg
wheel_build_env = .pkg
passenv =
HOME
PYTHON_HOST_ENV
DEBUG
extras = test
deps = -rrequirements{/}{envname}{/}test.txt
commands =
# Create a directory for reports not managed by `$ tox`:
python -c 'import pathlib; pathlib.Path(\
".{/}build{/}reports{/}{envname}").mkdir(parents=True, exist_ok=True)'
# Verify the package installation into this environment:
python -m "{[project]package}" --help
{[project]name} --help
# Run the full test suite and report test coverage:
coverage run --data-file=".{/}build{/}reports{/}{envname}{/}.coverage" -m pytest \
--junit-xml=".{/}build{/}reports{/}{envname}{/}pytest-junit.xml"
coverage json --fail-under=0 \
--data-file=".{/}build{/}reports{/}{envname}{/}.coverage" \
-o ".{/}build{/}reports{/}{envname}{/}coverage.json"
coverage lcov --fail-under=0 \
--data-file=".{/}build{/}reports{/}{envname}{/}.coverage" \
-o ".{/}build{/}reports{/}{envname}{/}coverage-lcov.info"
coverage xml --fail-under=0 \
--data-file=".{/}build{/}reports{/}{envname}{/}.coverage" \
-o ".{/}build{/}reports{/}{envname}{/}coverage.xml"
coverage html --fail-under=0 \
--data-file=".{/}build{/}reports{/}{envname}{/}.coverage" \
-d ".{/}build{/}reports{/}{envname}{/}htmlcov"
coverage report \
--data-file=".{/}build{/}reports{/}{envname}{/}.coverage"
[testenv:py311]
description = Run the project test suite with coverage and checks for code and content
extras =
test
devel
deps =
-rrequirements{/}{envname}{/}test.txt
-rrequirements{/}{envname}{/}devel.txt
allowlist_externals =
.{/}bin{/}test-*
bin{/}test-*
commands =
# Create a directory for reports not managed by `$ tox`:
python -c 'import pathlib; pathlib.Path(\
".{/}build{/}reports{/}{envname}").mkdir(parents=True, exist_ok=True)'
# Fail fast. Run quick tests and checks first to save time in the inner loop of
# development iteration.
pyroma --min="10" ".{/}"
black --check ".{/}src{/}{[project]package}{/}" \
".{/}tests{/}{[project]package}tests{/}"
# https://github.com/PyCQA/prospector/issues/599#issue-1600120419
pylint --output-format "\
parseable:.{/}build{/}reports{/}{envname}{/}pylint.parseable,\
json:.{/}build{/}reports{/}{envname}{/}pylint.json,\
msvs:.{/}build{/}reports{/}{envname}{/}pylint.msvs,\
colorized" ".{/}src{/}{[project]package}{/}" \
".{/}tests{/}{[project]package}tests{/}"
# https://pawamoy.github.io/posts/python-static-code-analysis-tools/#prospector
./bin/test-lint-prospector.sh \
--output-format \
"emacs:.{/}build{/}reports{/}{envname}{/}prospector-emacs.txt" \
--output-format \
"grouped:.{/}build{/}reports{/}{envname}{/}prospector-grouped.txt" \
--output-format \
"json:.{/}build{/}reports{/}{envname}{/}prospector.json" \
--output-format \
"pylint:.{/}build{/}reports{/}{envname}{/}prospector.pylint" \
--output-format \
"text:.{/}build{/}reports{/}{envname}{/}prospector.txt" \
--output-format \
"vscode:.{/}build{/}reports{/}{envname}{/}prospector-vscode.txt" \
--output-format \
"xunit:.{/}build{/}reports{/}{envname}{/}prospector-xunit.xml" \
--output-format \
"yaml:.{/}build{/}reports{/}{envname}{/}prospector.yaml" \
--output-format "grouped"
# https://github.com/PyCQA/prospector/issues/599#issue-1600120419
vulture ".{/}src{/}{[project]package}{/}" ".{/}tests{/}{[project]package}tests{/}"
# https://xenon.readthedocs.io/en/latest/#an-actual-example
xenon --max-absolute "C" --max-modules "B" --max-average "A" \
".{/}src{/}{[project]package}{/}" ".{/}tests{/}{[project]package}tests{/}"
# Run more time consuming tests and checks last:
{[testenv]commands}
[testenv:build]
description = Independent build, release, devel tools (requires PYTHON_HOST_ENV)
skip_install = true
# Workaround an issue with `skip_install` and passing in the `--installpkg` command-line
# option:
# https://github.com/tox-dev/tox/issues/2442#issuecomment-1347549575
package_env =
deps = -rrequirements{/}{env:PYTHON_HOST_ENV:py311}{/}build.txt
allowlist_externals =
.{/}bin{/}test-*
bin{/}test-*
pass_env = GITHUB_ACTIONS
# Moved to shell scripts for re-use in `$ make test-lint-*`:
commands =
.{/}bin{/}test-lint-docs.sh
.{/}bin{/}test-lint-prose.sh
[testenv:.pkg]
deps =
build
setuptools>=45
wheel
setuptools_scm>=6.2
package_glob = {work_dir}{/}.pkg{/}tmp{/}dist{/}*.whl
commands =
pyproject-build --outdir {work_dir}{/}.pkg{/}tmp{/}dist{/} --no-isolation \
--skip-dependency-check
[doc8]
max-line-length=88