-
Notifications
You must be signed in to change notification settings - Fork 309
/
tox.ini
143 lines (131 loc) · 3.42 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
133
134
135
136
137
138
139
140
141
142
143
[tox]
minversion = 3.8
envlist = lint,types,py{38,39,310,311,312,313},integration,docs
isolated_build = True
[testenv]
deps =
pretend
pytest
pytest-socket
build
coverage
# Needed on 3.12 and newer due to setuptools not being pre-installed
# in fresh venvs.
# See: https://github.com/python/cpython/issues/95299
setuptools
passenv =
PYTEST_ADDOPTS
setenv =
HOME=/tmp/nonexistent
commands =
python -m coverage run -m pytest {posargs}
python -m coverage html
python -m coverage report --skip-covered --show-missing --fail-under 97
[testenv:integration]
deps =
{[testenv]deps}
pytest-rerunfailures
pytest-services
devpi-server
devpi
pypiserver
passenv =
PYTEST_ADDOPTS
commands =
pytest -r aR tests/test_integration.py {posargs}
[testenv:docs]
deps =
-rdocs/requirements.txt
allowlist_externals =
sh
commands =
sphinx-build -W --keep-going -b html -d {envtmpdir}/doctrees docs docs/_build/html
sphinx-build -W --keep-going -b doctest -d {envtmpdir}/doctrees docs docs/_build/html
doc8 docs README.rst --ignore-path docs/_build/html
sphinx-build -W --keep-going -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/linkcheck
sh -c "python -m twine check --strict $TOX_PACKAGE"
[testenv:watch-docs]
deps =
-rdocs/requirements.txt
sphinx-autobuild
commands =
sphinx-autobuild -b html -d {envtmpdir}/doctrees \
--watch twine \
{posargs:--host 127.0.0.1} \
docs docs/_build/html
[testenv:format]
skip_install = True
deps =
isort
black
commands =
isort twine/ tests/
black twine/ tests/
[testenv:lint]
skip_install = True
deps =
{[testenv:format]deps}
flake8
flake8-docstrings
commands =
isort --check-only --diff twine/ tests/
black --check --diff twine/ tests/
flake8 twine/ tests/
[testenv:types]
deps =
mypy
# required for report generation. 5.2.1 is forbidden due to an observed
# broken wheel on CPython 3.8:
# https://bugs.launchpad.net/lxml/+bug/2064158
lxml >= 5.2.0, != 5.2.1
# required for more thorough type declarations
keyring >= 22.3
# consider replacing with `mypy --install-types` when
# https://github.com/python/mypy/issues/10600 is resolved
types-requests
commands =
pip list
mypy --html-report mypy --txt-report mypy {posargs:twine}
python -c 'with open("mypy/index.txt") as f: print(f.read())'
[testenv:changelog]
basepython = python3
deps =
towncrier
commands =
towncrier build {posargs}
# Usage:
# tox -e create-changelog-item -- [additional arguments] {filename}.{bugfix,feature,doc,removal,misc}
[testenv:create-changelog-item]
basepython = python3
skip_install = True
deps = towncrier
commands =
towncrier create --config pyproject.toml {posargs}
[testenv:release]
# specify Python 3 to use platform's default Python 3
basepython = python3
deps =
build
passenv =
TWINE_PASSWORD
TWINE_REPOSITORY
setenv =
TWINE_USERNAME = {env:TWINE_USERNAME:__token__}
commands =
python -c "import shutil; shutil.rmtree('dist', ignore_errors=True)"
python -m build
python -m twine upload dist/*
[testenv:dev]
envdir = {posargs:venv}
recreate = True
deps =
{[testenv]deps}
{[testenv:integration]deps}
{[testenv:format]deps}
{[testenv:lint]deps}
{[testenv:types]deps}
download = True
usedevelop = True
commands =
python -c 'import sys; print(sys.executable)'
python --version