forked from pganssle/zoneinfo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
157 lines (145 loc) · 3.57 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
[tox]
minversion = 3.18.0
isolated_build = True
skip_missing_interpreters = true
[testenv]
description = Run the tests
deps =
coverage[toml]
dataclasses; python_version<"3.7"
hypothesis>=5.7.0,<5.43
importlib_metadata<5.0.0; python_version<"3.8"
pytest
pytest-cov
pytest-randomly
pytest-subtests
pytest-xdist
extras =
{env:TEST_EXTRAS_TOX:}
setenv =
COVERAGE_FILE={toxworkdir}/.coverage/.coverage.{envname}
CFLAGS={env:CFLAGS:-UNDEBUG}
commands =
pytest {toxinidir} {posargs: --cov=backports.zoneinfo --cov=tests}
# This should probably be integrated into the main testenv as an option if such
# a thing is possible, but because it's more important that it runs on CI and
# it's not necessarily very cross-platform, I've split it out for now.
[testenv:gcov]
description = Run the tests and collect C coverage stats
deps =
gcovr
dataclasses; python_version<"3.7"
hypothesis>=5.7.0,<5.43
importlib_metadata<5.0.0; python_version<"3.8"
pytest
pytest-subtests
extras =
tzdata
passenv =
CC
setenv =
CFLAGS=--coverage -fprofile-dir={envdir}/coverage
LDFLAGS=--coverage
GCNO_TARGET_DIR={envdir}/coverage
commands =
pytest {toxinidir}
gcovr -r {toxinidir} -k
python -c "import os; os.makedirs('{toxworkdir}/.coverage', exist_ok=True)"
gcovr -r {toxinidir} --xml \
-o {toxworkdir}/.coverage/.gcov_coverage.{envname}.xml
[testenv:coverage-report]
skip_install = true
deps = coverage[toml]>=5.0.2
depends = py38
setenv=COVERAGE_FILE=.coverage
changedir = {toxworkdir}/.coverage
commands =
coverage combine
coverage report
coverage xml
[testenv:format]
description = Run auto formatters
skip_install = True
allowlist_externals=
bash
deps =
black
isort>=5.0.0
commands =
black .
isort scripts src tests docs
bash -c 'clang-format --verbose -i lib/*.c'
[testenv:lint]
description = Run linting checks
skip_install = True
depends = format
deps =
black
isort>=5.0.0
pylint
commands =
black --check .
isort --check-only scripts src tests docs
pylint docs scripts src tests
[testenv:benchmark]
description = Run benchmarks
deps =
click
pytz
python-dateutil
tzdata
pint[uncertainties]
commands =
python scripts/benchmark.py {posargs}
[testenv:docs]
description = Build the documentation
skip_install = True
deps =
-rdocs/requirements.txt
commands =
sphinx-build -d "{toxworkdir}/docs_doctree" "{toxinidir}/docs" \
"{toxinidir}/docs/_output" {posargs: -j auto --color -bhtml}
[testenv:mypy]
description = Run mypy on the testing example
basepython = 3.8
deps =
mypy < 1
commands =
mypy src/backports/zoneinfo/__init__.pyi
mypy tests/typing_example.py
mypy scripts/update_test_data.py
[testenv:build]
description = Build a wheel and source distribution
skip_install = True
passenv = *
deps =
build
commands =
python -m build {posargs} {toxinidir} -o {toxinidir}/dist
[testenv:build-check]
description = Build a wheel and source distribution
skip_install = True
deps =
twine
depends = build
commands =
twine check dist/*
[testenv:check-version-tag]
description = Ensure that the current version matches the current tag
deps =
commands =
python scripts/check_tag.py
[testenv:release]
description = Make a release; must be called after "build"
skip_install = True
deps =
twine
depends =
build
auditwheel
passenv =
TWINE_*
commands =
twine check {toxinidir}/dist/*
twine upload {toxinidir}/dist/* \
{posargs:-r {env:TWINE_REPOSITORY:testpypi} --non-interactive}