-
Notifications
You must be signed in to change notification settings - Fork 198
/
tox.ini
157 lines (124 loc) · 4.18 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
# For more information about tox, see https://tox.readthedocs.io/en/latest/
[tox]
minversion = 3.3
envlist =
py3,
py3-httpx,
styleck,
typeck
# Enable slower `isolated_build` for PEP-518 compatibility
isolated_build = true
[testenv]
deps =
pytest ~= 6.2
pytest-cov ~= 2.11
pytest-dependency ~= 0.5
pytest-localserver ~= 0.5
pytest-mock ~= 3.5
pytest-order ~= 0.8
pytest-cid ~= 1.1
py-cid
whitelist_externals = ipfs
passenv = IPFS_* PY_IPFS_HTTP_CLIENT_*
commands =
python -X utf8 "{toxinidir}/test/run-tests.py" {posargs}
# Silence warning about not inheriting PYTHONPATH
setenv =
PYTHONPATH =
[testenv:py3-httpx]
deps-exclusive =
httpx (~= 0.14.0)
httpcore (~= 0.10.2)
deps =
{[testenv]deps}
{[testenv:py3-httpx]deps-exclusive}
setenv =
{[testenv]setenv}
PY_IPFS_HTTP_CLIENT_PREFER_HTTPX = yes
commands =
python -X utf8 "{toxinidir}/test/run-tests.py" {posargs}
[testenv:styleck]
isolated_build = false
skipsdist = true
deps =
flake8 ~= 3.7
flake8-tabs ~= 2.2 , >= 2.2.1
commands =
flake8 {posargs}
[testenv:typeck]
skip_install = true
deps =
mypy ~= 0.812
pytest ~= 6.2
{[testenv:py3-httpx]deps-exclusive}
commands =
mypy --config-file=tox.ini {posargs} -p ipfshttpclient
# Pass down TERM environment variable to allow mypy output to be colorized
# See: https://github.com/tox-dev/tox/issues/1441
passenv = TERM
[testenv:coverage]
deps =
coverage
commands =
python "{toxinidir}/test/combine-coverage.py" {posargs}
#TODO: Migrate away from this file to `pyproject.toml` once `flake8`, `mypy` and `pytest` support using it:
# * flake8: https://gitlab.com/pycqa/flake8/issues/428 (considering flakehell and flake9 here)
# * mypy: https://github.com/python/mypy/issues/5205
# * pytest: https://github.com/pytest-dev/pytest/issues/1556 (will be part of 6.0)
[flake8]
exclude = .git,.tox,+junk,coverage,dist,doc,*egg,build,tools,test/unit,docs,*__init__.py,venv
# E221: Multiple spaces before operator
# E241: Multiple spaces after ',': Breaks element alignment collections
# E251: Spaces around '=' on parameter assignment
# E262: Inline comment should start with '# ': Breaks tagged comments (ie: '#TODO: ')
# E265: Block comment should start with '# ': ^
# E266: Too many leading '#' for block comment: Breaks declaring mega-blocks (ie: '### Section')
# E303: More than 2 consecutive newlines
# E722: Using bare except for cleanup-on-error is fine
# (see bug report at https://github.com/PyCQA/pycodestyle/issues/703)
# W292: No newline at end of file
# W391: Blank line at end of file (sometimes triggered instead of the above!?)
# F403: `from <module> import *` used; unable to detect undefined names ←– Probably should be fixed…
# F811: PyFlakes bug: `@ty.overload` annotation is not detected to mean `@typing.overload`
# (see bug report at https://github.com/PyCQA/pyflakes/issues/561)
ignore = E221,E241,E251,E262,E265,E266,E303,E722,W292,W391,F403,F811
use-flake8-tabs = true
max-line-length = 100
tab-width = 4
# E701: Multiple statements on one line
# - requests_wrapper.py: Lots of symbols exported that we specifically don't use but that make sense in a reusable module
# - test_*.py: Aligning `assert … not in …` and `assert … in …` kind of statements
per-file-ignores =
./ipfshttpclient/requests_wrapper.py:E401,E402,F401
./test/functional/test_*.py:E272
[mypy]
# CLI behaviour
color_output = true
show_error_codes = true
pretty = true
# Include package directories without `__init__.py`
namespace_packages = true
# Extra strictness
disallow_any_unimported = true
#disallow_any_expr = true
#disallow_any_decorated = true # Mostly OK, but fails at custom decorators
disallow_any_generics = true
disallow_subclassing_any = true
#disallow_untyped_calls = true # Fails at many trio APIs that aren't typed yet
disallow_untyped_defs = true
strict_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_return_any = true
warn_unreachable = true
[mypy-ipfshttpclient.client.*]
ignore_errors = True
[mypy-ipfshttpclient.client.base]
ignore_errors = False
[pytest]
addopts = -ra --verbose
console_output_style = progress
testpaths =
ipfshttpclient
test/unit
test/functional