-
Notifications
You must be signed in to change notification settings - Fork 2
/
tox.ini
183 lines (163 loc) · 4.11 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
[tox]
minversion = 3.18
envlist = codestyle,docstyle,errors,types,test,coverage
isolated_build = True
[testenv]
install_command = pip install -i {env:PIP_INDEX_URL:https://pypi.org/simple} {opts} {packages}
extras = test
commands =
test-py3{8,9,10,11}: pytest {posargs:tests}
[testenv:format]
description = Autoformat code.
skip_install = true
envdir = {toxworkdir}/lint
deps =
ruff
commands =
ruff check --select I --fix {posargs:src/ tests/}
ruff format {posargs:src/ tests/}
[testenv:format-check]
description = Check code style using black.
skip_install = true
envdir = {toxworkdir}/lint
deps =
ruff
commands =
ruff format --check {posargs:src/ tests/}
ruff check --select I --diff {posargs:src/ tests/}
[testenv:lint]
description = Check code for stylistic and logical errors.
envdir = {toxworkdir}/lint
deps =
{[testenv:codestyle]deps}
{[testenv:docstyle]deps}
{[testenv:types]deps}
{[testenv:errors]deps}
commands =
{[testenv:codestyle]commands}
{[testenv:docstyle]commands}
{[testenv:types]commands}
{[testenv:errors]commands}
[testenv:codestyle]
description = Check code and tests for PEP 8 compliance and code complexity.
skip_install = true
envdir = {toxworkdir}/lint
deps =
ruff
commands =
ruff check {posargs:src/ tests/} --select E,W,C --ignore C901
ruff check {posargs:src/ tests/} --select I --diff
[testenv:docstyle]
description = Check docstrings for PEP 257 compliance (Google style).
skip_install = true
envdir = {toxworkdir}/lint
deps =
ruff
commands = ruff check {posargs:src/} --select D
[testenv:flake]
description = Find errors with Flake.
envdir = {toxworkdir}/lint
deps =
ruff
commands =
ruff check {posargs:src/ tests/} --select F
[testenv:pylint]
description = Find errors with static code analysis.
envdir = {toxworkdir}/lint
deps =
pylint
commands =
pylint --output-format=colorized --errors-only {posargs:src/pytest_fluent}
[testenv:errors]
description = Find errors with static code analysis.
envdir = {toxworkdir}/lint
deps =
{[testenv:flake]deps}
{[testenv:pylint]deps}
commands =
{[testenv:flake]commands}
{[testenv:pylint]commands}
[testenv:types]
description = Run static type checker.
skip_install = true
envdir = {toxworkdir}/lint
deps =
mypy
types-six
commands =
mypy --check-untyped-defs --no-implicit-optional {posargs:src/ tests/}
[testenv:test]
description = Run tests with pytest.
passenv = CI
setenv =
COVERAGE_FILE = .coverage.{env:OS:linux}
extras = test
deps =
pytest
pytest-cov
commands =
pytest --cov --cov-report= {posargs:tests}
[testenv:coverage]
description = Measure, combine and report coverage.
deps =
coverage[toml] >= 6.0
commands =
coverage combine
coverage report
coverage xml
coverage html --fail-under 50
[testenv:test_with_reports]
description = Run tests with pytest and report coverage.
envdir = {toxworkdir}/test_cov
deps =
{[testenv:test]deps}
{[testenv:coverage]deps}
commands =
{[testenv:test]commands} --junitxml=report.xml
{[testenv:coverage]commands}
[testenv:clean]
description = Remove all generated and temporary files.
skip_install = true
allowlist_externals =
git
deps =
coverage[toml]
commands =
coverage erase
git clean -xfd
[testenv:docs]
description = Generate API documentation.
changedir = docs
extras = docs
setenv =
WORKSPACE_ROOT_PATH = {toxinidir}
commands =
sphinx-build -W -d {envtmpdir}/doctrees . {envtmpdir}/html
[testenv:version]
description = Increment version number.
skip_install = true
deps = bump2version
commands = bumpversion --verbose --tag --commit {posargs}
[testenv:build]
description = Build package.
allowlist_externals =
git
deps =
build[virtualenv]
commands =
git clean -xfd dist/
python -m build
[testenv:upload]
description = Upload package
deps = twine
passenv =
TWINE_USERNAME
TWINE_PASSWORD
REPOSITORY_URL
commands = twine upload dist/*
[flake8]
ignore = W503,E203
max-line-length = 88
format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s
[pydocstyle]
convention = pep257