mirror of
https://github.com/ipfs-shipyard/py-ipfs-http-client.git
synced 2021-08-30 00:23:11 +03:00
pytest_ordering seems unmaintained as it hasn't been updated in two years: https://github.com/ftobia/pytest-ordering. It is also broken, at least in Nixpkgs: https://github.com/NixOS/nixpkgs/pull/122264.
pytest_order is a maintained and working fork.
I added a similar patch to Nixpkgs a while ago to make it work there: 6965eef223/pkgs/development/python-modules/ipfshttpclient/default.nix (L59-L63).
Co-authored-by: ntninja (Alexander Schlarb)
158 lines
4.2 KiB
INI
158 lines
4.2 KiB
INI
# 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
|