-
Notifications
You must be signed in to change notification settings - Fork 2
/
tox.ini
97 lines (92 loc) · 2.4 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
[tox]
minversion = 3.16.1
envlist =
lint
packaging
py
isolated_build = true
requires =
setuptools >= 41.4.0
pip >= 19.3.0
skip_missing_interpreters = True
skipsdist = true
[testenv]
description =
Run the tests with {basepython}
deps =
--editable .[test]
commands =
coverage run -m pytest {posargs:}
commands_pre =
# safety measure to assure we do not accidentally run tests with broken dependencies
{envpython} -m pip check
passenv =
CURL_CA_BUNDLE # https proxies, https://github.com/tox-dev/tox/issues/1437
FORCE_COLOR
HOME
NO_COLOR
PYTEST_* # allows developer to define their own preferences
PY_COLORS
REQUESTS_CA_BUNDLE # https proxies
SSL_CERT_FILE # https proxies
LANG
LC_ALL
LC_CTYPE
setenv =
COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
PIP_DISABLE_PIP_VERSION_CHECK = 1
PIP_CONSTRAINT = {toxinidir}/requirements.txt
PRE_COMMIT_COLOR = always
PYTEST_REQPASS = 78
FORCE_COLOR = 1
allowlist_externals =
sh
[testenv:lint]
description = Run all linters
# locked basepython is needed because to keep constrains.txt predictable
basepython = python3.9
deps =
pip-tools>=6.8.0
pre-commit>=2.6.0
setuptools>=51.1.1
skip_install = true
usedevelop = false
commands =
{envpython} -m pre_commit run -a --show-diff-on-failure {posargs:}
passenv =
{[testenv]passenv}
PRE_COMMIT_HOME
setenv =
{[testenv]setenv}
PIP_CONSTRAINT = /dev/null
[testenv:deps]
description = Bump all test dependencies
basepython = {[testenv:lint]basepython}
envdir = {toxworkdir}/lint
deps = {[testenv:lint]deps}
skip_install = true
commands =
{[testenv:lint]commands} --hook-stage manual
[testenv:packaging]
basepython = python3
description =
Build package, verify metadata, install package and assert behavior when ansible is missing.
deps =
build >= 0.5.0
twine >= 3.4.1
skip_install = true
# Ref: https://twitter.com/di_codes/status/1044358639081975813
commands =
# build wheel and sdist using PEP-517
{envpython} -c 'import os.path, shutil, sys; \
dist_dir = os.path.join("{toxinidir}", "dist"); \
os.path.isdir(dist_dir) or sys.exit(0); \
print("Removing \{!s\} contents...".format(dist_dir), file=sys.stderr); \
shutil.rmtree(dist_dir)'
{envpython} -m build \
--outdir {toxinidir}/dist/ \
{toxinidir}
# Validate metadata using twine
twine check {toxinidir}/dist/*
# Install the wheel
sh -c "python3 -m pip install {toxinidir}/dist/*.whl"