Skip to content

Commit 204a51f

Browse files
committed
Upgrade pytest-plone to version 1.1.0
1 parent 9e4c938 commit 204a51f

6 files changed

Lines changed: 12 additions & 27 deletions

File tree

backend/news/74.internal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Upgrade `pytest-plone` to version 1.1.0 and adopt its new `create_site` / `app_class` fixtures in the test suite. @ericof

backend/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ test = [
4747
"pytest",
4848
"pytest-cov",
4949
"pytest-docker>=3.2.0",
50-
"pytest-plone>=1.0.0",
50+
"pytest-plone>=1.1.0",
5151
"plone-stubs",
5252
]
5353
container = [

backend/tests/conftest.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
from kitconcept.core.factory import add_site
21
from kitconcept.website.testing import FUNCTIONAL_TESTING
32
from kitconcept.website.testing import INTEGRATION_TESTING
4-
from plone import api
5-
from plone.app.testing.interfaces import SITE_OWNER_NAME
6-
from Products.CMFPlone.Portal import PloneSite
73
from pytest_plone import fixtures_factory
84
from typing import Any
95

@@ -76,13 +72,3 @@ def func() -> dict:
7672
@pytest.fixture(scope="session")
7773
def answers(prepare_answers) -> dict:
7874
return prepare_answers()
79-
80-
81-
@pytest.fixture(scope="session")
82-
def create_site(distribution_name):
83-
def func(app, answers: dict) -> PloneSite:
84-
with api.env.adopt_user(SITE_OWNER_NAME):
85-
site = add_site(app, distribution=distribution_name, **answers)
86-
return site
87-
88-
return func

backend/tests/content_types/test_ct_lrf.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from Acquisition import aq_parent
21
from collections.abc import Generator
32
from plone.dexterity.fti import DexterityFTI
43
from Products.CMFPlone.Portal import PloneSite
@@ -20,9 +19,8 @@ def answers() -> dict:
2019

2120

2221
@pytest.fixture(scope="class")
23-
def portal(portal_class, create_site, answers) -> Generator[PloneSite, None, None]:
24-
app = aq_parent(portal_class)
25-
site = create_site(app=app, answers=answers)
22+
def portal(app_class, create_site, answers) -> Generator[PloneSite, None, None]:
23+
site = create_site(app=app_class, answers=answers)
2624
yield site
2725

2826

backend/tests/creation/conftest.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
from Acquisition import aq_parent
21
from collections.abc import Generator
32
from Products.CMFPlone.Portal import PloneSite
43

54
import pytest
65

76

87
@pytest.fixture(scope="class")
9-
def portal(portal_class, create_site, answers) -> Generator[PloneSite, None, None]:
10-
app = aq_parent(portal_class)
11-
site = create_site(app=app, answers=answers)
8+
def portal(app_class, create_site, answers) -> Generator[PloneSite, None, None]:
9+
site = create_site(app=app_class, answers=answers)
1210
yield site

backend/uv.lock

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)