From 668cb33b05a77a4f98df7c91fe5539247522980c Mon Sep 17 00:00:00 2001 From: ZipFile Date: Sun, 6 Apr 2025 16:13:09 +0000 Subject: [PATCH 1/2] Move pytest config to pyproject.toml --- Makefile | 2 +- pyproject.toml | 14 ++++++++++++++ tests/.configs/pytest.ini | 13 ------------- tox.ini | 8 ++++---- 4 files changed, 19 insertions(+), 18 deletions(-) delete mode 100644 tests/.configs/pytest.ini diff --git a/Makefile b/Makefile index 84d0ef86..29e4086f 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ uninstall: test: # Unit tests with coverage report coverage erase - coverage run -m pytest -c tests/.configs/pytest.ini + coverage run -m pytest coverage report coverage html diff --git a/pyproject.toml b/pyproject.toml index eba17764..794b36d0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -99,3 +99,17 @@ ignore = ["tests"] [tool.pylint.design] min-public-methods = 0 max-public-methods = 30 + +[tool.pytest.ini_options] +testpaths = ["tests/unit/"] +asyncio_mode = "auto" +markers = [ + "pydantic: Tests with Pydantic as a dependency", +] +filterwarnings = [ + "ignore:Module \"dependency_injector.ext.aiohttp\" is deprecated since version 4\\.0\\.0:DeprecationWarning", + "ignore:Module \"dependency_injector.ext.flask\" is deprecated since version 4\\.0\\.0:DeprecationWarning", + "ignore:Please use \\`.*?\\` from the \\`scipy.*?\\`(.*?)namespace is deprecated\\.:DeprecationWarning", + "ignore:Please import \\`.*?\\` from the \\`scipy(.*?)\\` namespace(.*):DeprecationWarning", + "ignore:\\`scipy(.*?)\\` is deprecated(.*):DeprecationWarning", +] diff --git a/tests/.configs/pytest.ini b/tests/.configs/pytest.ini deleted file mode 100644 index ea92be96..00000000 --- a/tests/.configs/pytest.ini +++ /dev/null @@ -1,13 +0,0 @@ -[pytest] -testpaths = tests/unit/ -python_files = test_*_py3*.py -asyncio_mode = auto -markers = - pydantic: Tests with Pydantic as a dependency -filterwarnings = - ignore:Module \"dependency_injector.ext.aiohttp\" is deprecated since version 4\.0\.0:DeprecationWarning - ignore:Module \"dependency_injector.ext.flask\" is deprecated since version 4\.0\.0:DeprecationWarning - ignore:Please use \`.*?\` from the \`scipy.*?\`(.*?)namespace is deprecated\.:DeprecationWarning - ignore:Please import \`.*?\` from the \`scipy(.*?)\` namespace(.*):DeprecationWarning - ignore:\`scipy(.*?)\` is deprecated(.*):DeprecationWarning - ignore:ssl\.PROTOCOL_TLS is deprecated:DeprecationWarning:botocore.* diff --git a/tox.ini b/tox.ini index 54f99e57..b37bfeaa 100644 --- a/tox.ini +++ b/tox.ini @@ -19,7 +19,7 @@ deps= werkzeug extras= yaml -commands = pytest -c tests/.configs/pytest.ini +commands = pytest python_files = test_*_py3*.py setenv = COVERAGE_RCFILE = pyproject.toml @@ -45,7 +45,7 @@ deps = boto3 mypy_boto3_s3 werkzeug -commands = pytest -c tests/.configs/pytest.ini -m pydantic +commands = pytest -m pydantic [testenv:coveralls] passenv = GITHUB_*, COVERALLS_*, DEPENDENCY_INJECTOR_* @@ -57,7 +57,7 @@ deps= coveralls>=4 commands= coverage erase - coverage run -m pytest -c tests/.configs/pytest.ini + coverage run -m pytest coverage report coveralls @@ -74,7 +74,7 @@ deps= mypy_boto3_s3 extras= yaml -commands = pytest -c tests/.configs/pytest-py35.ini +commands = pytest [testenv:pylint] From 80ea9120b6e9f84695e5b8a82e8eda59a6f52ef7 Mon Sep 17 00:00:00 2001 From: ZipFile Date: Sun, 6 Apr 2025 16:18:04 +0000 Subject: [PATCH 2/2] Fix pytest warning --- tests/unit/ext/test_flask_py2_py3.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/ext/test_flask_py2_py3.py b/tests/unit/ext/test_flask_py2_py3.py index e64de165..3e79e067 100644 --- a/tests/unit/ext/test_flask_py2_py3.py +++ b/tests/unit/ext/test_flask_py2_py3.py @@ -11,7 +11,7 @@ def index(): return "Hello World!" -def test(): +def _test(): return "Test!" @@ -25,7 +25,7 @@ class ApplicationContainer(containers.DeclarativeContainer): app = flask.Application(Flask, __name__) index_view = flask.View(index) - test_view = flask.View(test) + test_view = flask.View(_test) test_class_view = flask.ClassBasedView(Test)