From edd766525137972ae1d717d5d7f20158014b0938 Mon Sep 17 00:00:00 2001 From: Subhash Bhushan Date: Wed, 29 May 2024 08:11:42 -0700 Subject: [PATCH] Upgrade pytest to 8.2.1 Also add `pytest` and `pytest-bdd` as default dependencies in project template. --- poetry.lock | 18 +++++++++--------- pyproject.toml | 3 +-- .../domain_template/pyproject.toml.jinja | 8 +++++++- .../{ => {{package_name}}}/conftest.py.jinja | 4 ++-- 4 files changed, 19 insertions(+), 14 deletions(-) rename src/protean/template/domain_template/tests/{ => {{package_name}}}/conftest.py.jinja (87%) diff --git a/poetry.lock b/poetry.lock index 6a40e277..2bf2836e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1587,13 +1587,13 @@ test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest- [[package]] name = "pluggy" -version = "1.3.0" +version = "1.5.0" description = "plugin and hook calling mechanisms for python" optional = false python-versions = ">=3.8" files = [ - {file = "pluggy-1.3.0-py3-none-any.whl", hash = "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7"}, - {file = "pluggy-1.3.0.tar.gz", hash = "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12"}, + {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, + {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, ] [package.extras] @@ -1865,23 +1865,23 @@ files = [ [[package]] name = "pytest" -version = "8.0.2" +version = "8.2.1" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.8" files = [ - {file = "pytest-8.0.2-py3-none-any.whl", hash = "sha256:edfaaef32ce5172d5466b5127b42e0d6d35ebbe4453f0e3505d96afd93f6b096"}, - {file = "pytest-8.0.2.tar.gz", hash = "sha256:d4051d623a2e0b7e51960ba963193b09ce6daeb9759a451844a21e4ddedfc1bd"}, + {file = "pytest-8.2.1-py3-none-any.whl", hash = "sha256:faccc5d332b8c3719f40283d0d44aa5cf101cec36f88cde9ed8f2bc0538612b1"}, + {file = "pytest-8.2.1.tar.gz", hash = "sha256:5046e5b46d8e4cac199c373041f26be56fdb81eb4e67dc11d4e10811fc3408fd"}, ] [package.dependencies] colorama = {version = "*", markers = "sys_platform == \"win32\""} iniconfig = "*" packaging = "*" -pluggy = ">=1.3.0,<2.0" +pluggy = ">=1.5,<2.0" [package.extras] -testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] +dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] [[package]] name = "pytest-asyncio" @@ -2845,4 +2845,4 @@ sqlite = ["sqlalchemy"] [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "507426e9290b84bbf96c7b90da0f0cdbd904d5d607fbca34a2427c24eca95527" +content-hash = "99ce7df751d2d41e76af5eb81a1cbf9f2ef503675d980e71197603397c2a5031" diff --git a/pyproject.toml b/pyproject.toml index 34a46a14..33b23df8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -103,11 +103,10 @@ optional = true [tool.poetry.group.test.dependencies] mock = "5.1.0" -pluggy = "1.3.0" pytest-asyncio = ">=0.21.1" pytest-cov = ">=4.1.0" pytest-mock = "3.12.0" -pytest = ">=7.4.3" +pytest = "^8.2.1" [tool.poetry.group.docs] optional = true diff --git a/src/protean/template/domain_template/pyproject.toml.jinja b/src/protean/template/domain_template/pyproject.toml.jinja index 87ee3400..57aee376 100644 --- a/src/protean/template/domain_template/pyproject.toml.jinja +++ b/src/protean/template/domain_template/pyproject.toml.jinja @@ -4,7 +4,6 @@ version = "0.1.0" description = "{{ short_description }}" authors = ["{{ author_name }} <{{ author_email }}>"] readme = "README.md" -packages = [{include = "{{ package_name|replace('_','-') }}"}] classifiers=[ # complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers "Programming Language :: Python", @@ -41,6 +40,13 @@ python = "^3.11" {%- endif %} protean = {version = "0.11.0", extras={{ extras }} } +[tool.poetry.group.test] +optional = true + +[tool.poetry.group.test.dependencies] +pytest = "^8.2.1" +pytest-bdd = "^7.1.2" + [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" diff --git a/src/protean/template/domain_template/tests/conftest.py.jinja b/src/protean/template/domain_template/tests/{{package_name}}/conftest.py.jinja similarity index 87% rename from src/protean/template/domain_template/tests/conftest.py.jinja rename to src/protean/template/domain_template/tests/{{package_name}}/conftest.py.jinja index efd17c88..2481d480 100644 --- a/src/protean/template/domain_template/tests/conftest.py.jinja +++ b/src/protean/template/domain_template/tests/{{package_name}}/conftest.py.jinja @@ -16,7 +16,7 @@ def pytest_sessionstart(session): Fetch and activate the domain by pushing the associated domain_context. The activated domain can then be referred to elsewhere as `current_domain` """ - os.environ["{{ package_name|upper }}_ENV"] = session.config.option.env + os.environ["PROTEAN_ENV"] = session.config.option.env from {{ package_name }}.domain import {{ package_name }} {{ package_name }}.domain_context().push() @@ -27,7 +27,7 @@ def run_around_tests(): """Fixture to automatically cleanup infrastructure after every test""" yield - from protean.globals import current_domain, g + from protean.globals import current_domain # Clear all databases for _, provider in current_domain.providers.items():