Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/news/74.internal
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
14 changes: 0 additions & 14 deletions backend/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
6 changes: 2 additions & 4 deletions backend/tests/content_types/test_ct_lrf.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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


Expand Down
6 changes: 2 additions & 4 deletions backend/tests/creation/conftest.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from Acquisition import aq_parent
from collections.abc import Generator
from Products.CMFPlone.Portal import PloneSite

import pytest


@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
10 changes: 6 additions & 4 deletions backend/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading