При запуске pytest из tox я получаю предупреждения относительно библиотек, установленных в virtualenv.Я хочу ограничить запуск pytest только на моем пакете, но не могу понять, как это сделать!
Некоторые детали:
моя конфигурация tox.ini
[tox]
minversion = 2.0
envlist = py3, pylint, flake8, bandit
skip_missing_interpreters = true
skipsdist = True
[testenv]
usedevelop = True
install_command = pip3 install {opts} {packages}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
setenv =
PYTHONDONTWRITEBYTECODE=1
whitelist_externals = sh
find
rm
commands =
find . -type f -name "*.py[c|o]" -delete
passenv = HOME
[testenv:py3]
basepython = python3
#norecursedirs = {envdir}
commands =
{[testenv]commands}
pytest -s -v --cov=awsxacc_pkg tests
Тестыdir имеет следующее содержимое:
> ls tests/
artifacts __init__.py __pycache__ test_list_account.py
Когда я запускаю tox с tox -e py3
, я получаю:
collected 4 items
tests/test_list_account.py::test_list_all_account PASSED
tests/test_list_account.py::test_base64_encoding PASSED
tests/test_list_account.py::test_odin_aws_accounts PASSED
tests/test_list_account.py::test_account_name_to_number PASSED
============================================================= warnings summary =============================================================
.tox/py3/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py:152
.tox/py3/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py:152: DeprecationWarning: invalid escape sequence \*
"""
.tox/py3/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py:503
.tox/py3/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py:503: DeprecationWarning: invalid escape sequence \*
"""
...
...
...
.tox/py3/lib/python3.6/site-packages/boto3/resources/params.py:22
.tox/py3/lib/python3.6/site-packages/boto3/resources/params.py:22: DeprecationWarning: invalid escape sequence \[
INDEX_RE = re.compile('\[(.*)\]$')
----------- coverage: platform linux, python 3.6.8-final-0 -----------
Name Stmts Miss Cover
----------------------------------------------------------
src/awsxacc_pkg/__init__.py 1 0 100%
src/awsxacc_pkg/awsxacc.py 168 122 27%
----------------------------------------------------------
TOTAL 169 122 28%
================================================== 4 passed, 20 warnings in 1.09 seconds ===================================================
Я могу избавиться от предупреждения, добавив --disable-warnings
к параметру pytestно это просто скрывает предупреждение.