-
Notifications
You must be signed in to change notification settings - Fork 4
/
tox.ini
104 lines (98 loc) · 3.26 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
[tox]
skip_missing_interpreters = true
isolated_build = true
envlist =
py3{8,9,10}
[base_configs]
wheel = false
parallel_show_output = true
[testenv]
description = Run test suite under {basepython}
setenv =
PIP_DISABLE_VERSION_CHECK = 1
COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
PY_COLORS = 1
deps = -r requirements-dev.txt
passenv =
http_proxy
https_proxy
no_proxy
commands = pytest \
--benchmark-disable \
--junitxml={toxworkdir}/junit.{envname}.xml \
--basetemp={envtmpdir} \
-n={env:PYTEST_XDIST_PROC_NR:auto} \
{posargs:tests}
wheel = {[base_configs]wheel}
parallel_show_output = {[base_configs]parallel_show_output}
[testenv:py3{8,9,10}-benchmark-{pure_python}]
description = Run performance testing under {basepython}
setenv =
{[testenv]setenv}
pure_python: LIB_TYPE=pure_python
deps = {[testenv]deps}
passenv = {[testenv]passenv}
allowlist_externals = bash
commands =
# Run benchmark in a shell to incorporate dynamic tag in output file names
bash -c '\
SYS_PLATFORM=$(python -c "import sys; print(sys.platform.title())"); \
BENCHMARK_FILE_TAG={env:LIB_TYPE}-$(make strong-version-tag); \
BENCHMARK_FILE_PREFIX="{toxinidir}/.benchmarks/$\{SYS_PLATFORM\}-C{basepython}/$\{BENCHMARK_FILE_TAG\}"; \
mkdir -p $\{BENCHMARK_FILE_PREFIX%/*\}; \
pytest \
--basetemp={envtmpdir} \
--benchmark-cprofile=cumtime \
--benchmark-disable-gc \
--benchmark-histogram="$\{BENCHMARK_FILE_PREFIX\}" \
--benchmark-json="$\{BENCHMARK_FILE_PREFIX\}".json \
--benchmark-min-rounds={env:BENCHMARK_MIN_ROUNDS:10} \
--benchmark-only \
--benchmark-save="$\{BENCHMARK_FILE_TAG\}" \
--benchmark-save-data \
--benchmark-sort=mean \
--benchmark-timer=time.process_time \
--benchmark-verbose \
--benchmark-warmup=on \
{posargs:tests}'
wheel =
pure_python: {[testenv]wheel}
parallel_show_output = {[testenv]parallel_show_output}
[testenv:precommit]
description = Run `pre-commit` hooks to auto-format and lint the codebase
deps =
pre-commit
# Pre-commit hooks that rely on finding their executables in the `.tox/precommit/bin`
mypy
pylint
# Dependencies that are imported in source code and therefore needed for above pre-commit hook execution
icontract
pytest
sphinx
typeguard
# Prod dependencies
-r requirements.txt
skip_install = true
; For shfmt
setenv = GOCACHE={envdir}/go-build
passenv =
HOMEPATH # needed on Windows
PROGRAMDATA # needed on Windows
SKIP # hook ids to skip
TERM # (e.g. for mypy color output (https://github.com/tox-dev/tox/issues/1441#issuecomment-548063521))
commands = pre-commit run {posargs} -vv --all-files --color always
python -c 'print("hint: run `make install-pre-commit-hooks` to add checks as pre-commit hook")'
[testenv:security]
skip_install = true
deps = safety
commands = safety check --full-report -r {toxinidir}/requirements-all.txt \
--ignore=51457 # CVE-2022-42969
[testenv:docs]
extras =
docs
passenv = TERM
setenv =
PYTHONHASHSEED = 0
commands =
sphinx-build -n -T -W -b html -d {envtmpdir}/doctrees docs/source docs/_build/html
sphinx-build -n -T -W -b doctest -d {envtmpdir}/doctrees docs/source docs/_build/html