From 204a51f21a4a67661b1c2d12426cfc6eb4c9571c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Andrei?= Date: Mon, 13 Jul 2026 23:59:42 -0300 Subject: [PATCH] Upgrade pytest-plone to version 1.1.0 --- backend/news/74.internal | 1 + backend/pyproject.toml | 2 +- backend/tests/conftest.py | 14 -------------- backend/tests/content_types/test_ct_lrf.py | 6 ++---- backend/tests/creation/conftest.py | 6 ++---- backend/uv.lock | 10 ++++++---- 6 files changed, 12 insertions(+), 27 deletions(-) create mode 100644 backend/news/74.internal diff --git a/backend/news/74.internal b/backend/news/74.internal new file mode 100644 index 0000000..6c7f594 --- /dev/null +++ b/backend/news/74.internal @@ -0,0 +1 @@ +Upgrade `pytest-plone` to version 1.1.0 and adopt its new `create_site` / `app_class` fixtures in the test suite. @ericof diff --git a/backend/pyproject.toml b/backend/pyproject.toml index 246ace9..302872e 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -47,7 +47,7 @@ test = [ "pytest", "pytest-cov", "pytest-docker>=3.2.0", - "pytest-plone>=1.0.0", + "pytest-plone>=1.1.0", "plone-stubs", ] container = [ diff --git a/backend/tests/conftest.py b/backend/tests/conftest.py index f0fd9a8..d1480f6 100644 --- a/backend/tests/conftest.py +++ b/backend/tests/conftest.py @@ -1,9 +1,5 @@ -from kitconcept.core.factory import add_site from kitconcept.website.testing import FUNCTIONAL_TESTING from kitconcept.website.testing import INTEGRATION_TESTING -from plone import api -from plone.app.testing.interfaces import SITE_OWNER_NAME -from Products.CMFPlone.Portal import PloneSite from pytest_plone import fixtures_factory from typing import Any @@ -76,13 +72,3 @@ def func() -> dict: @pytest.fixture(scope="session") def answers(prepare_answers) -> dict: return prepare_answers() - - -@pytest.fixture(scope="session") -def create_site(distribution_name): - def func(app, answers: dict) -> PloneSite: - with api.env.adopt_user(SITE_OWNER_NAME): - site = add_site(app, distribution=distribution_name, **answers) - return site - - return func diff --git a/backend/tests/content_types/test_ct_lrf.py b/backend/tests/content_types/test_ct_lrf.py index be12670..20a5ff0 100644 --- a/backend/tests/content_types/test_ct_lrf.py +++ b/backend/tests/content_types/test_ct_lrf.py @@ -1,4 +1,3 @@ -from Acquisition import aq_parent from collections.abc import Generator from plone.dexterity.fti import DexterityFTI from Products.CMFPlone.Portal import PloneSite @@ -20,9 +19,8 @@ def answers() -> dict: @pytest.fixture(scope="class") -def portal(portal_class, create_site, answers) -> Generator[PloneSite, None, None]: - app = aq_parent(portal_class) - site = create_site(app=app, answers=answers) +def portal(app_class, create_site, answers) -> Generator[PloneSite, None, None]: + site = create_site(app=app_class, answers=answers) yield site diff --git a/backend/tests/creation/conftest.py b/backend/tests/creation/conftest.py index 9dd7b98..048559a 100644 --- a/backend/tests/creation/conftest.py +++ b/backend/tests/creation/conftest.py @@ -1,4 +1,3 @@ -from Acquisition import aq_parent from collections.abc import Generator from Products.CMFPlone.Portal import PloneSite @@ -6,7 +5,6 @@ @pytest.fixture(scope="class") -def portal(portal_class, create_site, answers) -> Generator[PloneSite, None, None]: - app = aq_parent(portal_class) - site = create_site(app=app, answers=answers) +def portal(app_class, create_site, answers) -> Generator[PloneSite, None, None]: + site = create_site(app=app_class, answers=answers) yield site diff --git a/backend/uv.lock b/backend/uv.lock index 3d9c240..3a8d056 100644 --- a/backend/uv.lock +++ b/backend/uv.lock @@ -1524,7 +1524,7 @@ test = [ { name = "pytest" }, { name = "pytest-cov" }, { name = "pytest-docker", specifier = ">=3.2.0" }, - { name = "pytest-plone", specifier = ">=1.0.0" }, + { name = "pytest-plone", specifier = ">=1.1.0" }, ] [[package]] @@ -4908,7 +4908,7 @@ wheels = [ [[package]] name = "pytest-plone" -version = "1.0.0" +version = "1.1.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "plone-api" }, @@ -4916,6 +4916,8 @@ dependencies = [ { name = "plone-base" }, { name = "plone-browserlayer" }, { name = "plone-dexterity" }, + { name = "plone-distribution" }, + { name = "plone-exportimport" }, { name = "products-cmfplone", extra = ["test"] }, { name = "pytest" }, { name = "requests" }, @@ -4923,9 +4925,9 @@ dependencies = [ { name = "zope-pytestlayer" }, { name = "zope-schema" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/44/57/3b6cac92b5554e1c7f124dcb2b8cf25bc3de63668d264fee2c43ab4240ca/pytest_plone-1.0.0.tar.gz", hash = "sha256:3c60b893edc9a1dadf2a21b090b1ca389a2787dc754105ee7b6b35721361a822", size = 28120, upload-time = "2026-05-18T22:12:42.902Z" } +sdist = { url = "https://files.pythonhosted.org/packages/a1/9e/51694db94e142b545835d3070d213a631d29387a62a1f5fec5a00c5c237e/pytest_plone-1.1.0.tar.gz", hash = "sha256:9f3ac2e4f975dddf9c773f176de2114467d624016250bef01f8763a2d482dcf2", size = 67794, upload-time = "2026-07-13T22:17:11.462Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/eb/a8/01780c4ded556b57e617e88e0cd0c2eb11c6f41f0f27aec3d5b3e4c1885d/pytest_plone-1.0.0-py3-none-any.whl", hash = "sha256:51533c8df40947fcf7eae865483bae6e7ac4b94481c55724846cdd86868ef058", size = 23434, upload-time = "2026-05-18T22:12:41.303Z" }, + { url = "https://files.pythonhosted.org/packages/7b/a3/c32e1cc815f32b5ecd4bc8c1329f7490f35f59bf390d6eeb2a8c27610bc4/pytest_plone-1.1.0-py3-none-any.whl", hash = "sha256:89f69669ecb45f77ae3517238922f2c8a7e6eccd14dac8acd831f52a4fb4caf0", size = 30432, upload-time = "2026-07-13T22:17:10.107Z" }, ] [[package]]