-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
95 lines (84 loc) · 2.08 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
[tox]
skipsdist = true
envlist = py310{flake8, check-isort, check-formatting, test}
[testenv]
setenv =
SOURCE = {toxinidir}
TEST_SOURCE = {toxinidir}/test
PYTHONPATH = {env:SOURCE}
deps =
-rrequirements.txt
commands =
test: coverage erase
test: pytest {env:TEST_SOURCE}
flake8: flake8 {env:SOURCE} {env:TEST_SOURCE}
[testenv:check-isort]
deps =
isort
commands =
isort --check-only {env:SOURCE} {env:TEST_SOURCE}
; This task simply checks the python formatting and fails tox if it's not formatted correctly.
; it's better to run black on pre-commit and then have tox check that it's formatted during CI/CD.
[testenv:check-formatting]
deps =
black
skip_install = true
commands =
black --line-length 100 --check --diff {env:SOURCE} {env:TEST_SOURCE}
; This task is NOT run automatically when you run `tox`
; Run `tox -e format` in order to actually run the black formatter
[testenv:format]
deps =
black
skip_install = true
commands =
black --line-length 100 {env:SOURCE} {env:TEST_SOURCE}
[testenv:mypy]
skip_install = true
commands =
mypy src
[pytest]
addopts = --cov-config=tox.ini --cov=src --cov-report term-missing:skip-covered --cov-report html
python_classes =
*Test
Test*
junit_family = legacy
testpaths =
tests
[coverage:report]
exclude_lines =
pragma: no cover
# Don't complain about missing debug-only code:
def __repr__
if self\.debug
# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError
# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:
# Don't complain about abstract methods, they aren't run:
@(abc\.)?abstractmethod
precision = 2
fail_under = 70
[coverage:run]
concurrency = multiprocessing
[isort]
# make peace with black
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=100
[flake8]
ignore = E501,W503,D203
exclude =
.git,
.hypothesis,
.mypy_cache,
.pytest_cache,
.credentials,
docker,
staging,
.tox
max-complexity = 10