mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 23:12:08 -03:30
In essence, this configures Python to turn any warnings emitted in
runtime into errors[[1]]. This is the best practice that allows
reacting to future deprecation announcements that are coming from the
dependencies (direct, or transitive, or even CPython itself)[[2]].
The typical workflow looks like this:
1. If a dependency is updated an a warning is hit in tests, the
deprecated thing should be replaced with newer APIs.
2. If a dependency is transitive or we have no control over it
otherwise, the specific warning and a regex matching its message,
plus the module reference (where possible) can be added to the
list of temporary ignores in `pytest.ini`.
3. The list of temporary ignores should be reevaluated periodically,
including when dependency re-pinning in lockfile is happening.
[1]: https://docs.python.org/3/using/cmdline.html#cmdoption-W
[2]: https://pytest-with-eric.com/configuration/pytest-ignore-warnings/
52 lines
884 B
INI
52 lines
884 B
INI
[tox]
|
|
distshare = {homedir}/.tox/distshare
|
|
envlist =
|
|
lint,
|
|
test
|
|
skip_missing_interpreters = true
|
|
# recreate = true
|
|
# skipsdist = true
|
|
|
|
[testenv]
|
|
basepython = python3.11
|
|
setenv =
|
|
PYTHONPATH = {toxinidir}:{env:PYTHONPATH:}:.
|
|
deps =
|
|
websocket-client
|
|
coverage
|
|
mock
|
|
pytest
|
|
pytest-mock
|
|
|
|
commands =
|
|
coverage run --parallel --source awxkit -m pytest --doctest-glob='*.md' --junit-xml=report.xml {posargs}
|
|
coverage combine
|
|
coverage xml
|
|
|
|
[testenv:lint]
|
|
deps =
|
|
{[testenv]deps}
|
|
flake8
|
|
commands =
|
|
flake8 awxkit
|
|
# pylama --report report.pylama awxkit
|
|
# py.test awxkit --pylama --junitxml=report.pylama {posargs}
|
|
- coverage erase
|
|
|
|
[testenv:coveralls]
|
|
commands=
|
|
- coverage combine
|
|
- coverage report -m
|
|
- coveralls
|
|
|
|
[flake8]
|
|
max-line-length = 120
|
|
|
|
[pytest]
|
|
addopts = -v --tb=native
|
|
|
|
filterwarnings =
|
|
error
|
|
|
|
junit_family=xunit2
|