Skip to content

Upgrade pytest-plone to 1.1.0#133

Merged
sneridagh merged 1 commit into
mainfrom
issue-462
Jul 14, 2026
Merged

Upgrade pytest-plone to 1.1.0#133
sneridagh merged 1 commit into
mainfrom
issue-462

Conversation

@ericof

@ericof ericof commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What

Upgrade pytest-plone to >=1.1.0 and adapt the test layer setup to the new release.

GitLab issue: https://gitlab.kitconcept.io/kitconcept/distribution-kitconcept-intranet/-/issues/462

Why

pytest-plone 1.1.0 changed fixtures_factory to default to keep_session=True, which pins every registered layer's session-scoped fixture for the whole test session instead of tearing it down around each function-style test.

Because our conftest.py registers the acceptance, functional and integration layers, this kept them all set up simultaneously — and exposed a latent Plone site id collision:

  • The acceptance layer pulls in the stock plone.app.testing.PLONE_FIXTURE transitively, via plone.app.robotframework's REMOTE_LIBRARY_BUNDLE_FIXTURE (bases=(PLONE_FIXTURE,)).
  • The stock PLONE_FIXTURE.setUpDefaultContent creates a Plone site with the default id plone.
  • Our own CoreFixture also creates a site with site_id="plone".

With both sessions kept alive at once, the second site creation failed with BadRequest: The id "plone" is invalid - it is already in use.

How

  • Bump the pytest-plone pin to >=1.1.0 in backend/pyproject.toml (+ uv.lock).
  • Add backend/src/kitconcept/core/testing/robot.py exposing RF_LIBRARIES (the robot remote-library tuple).
  • Rebuild REMOTE_LIBRARY_BUNDLE_FIXTURE locally with bases=(kitconcept_FIXTURE,) so it rides on our kitconcept site instead of the stock PLONE_FIXTURE. RemoteLibraryLayer itself creates no site — it only attaches remote libraries to PloneSite — so re-parenting is safe.
  • Keep the faster keep_session=True.
  • Rename the distribution fixture to distribution_name and make create_site idempotent (drop a pre-existing site id before recreating).

Test plan

  • make test / uv run pytest in backend/288 passed.

Local Results

x5.8 improvement:

  • pytest-plone 1.0.0: 288 passed in 66.38s (0:01:06)
  • pytest-plone 1.1.0: 288 passed in 11.40s

Bump pytest-plone to >=1.1.0. The new keep_session=True default keeps all
registered layer sessions pinned at once, which exposed a duplicate Plone
site collision: the acceptance layer pulled in the stock PLONE_FIXTURE (via
plone.app.robotframework's REMOTE_LIBRARY_BUNDLE_FIXTURE), whose default
setUpDefaultContent creates a site with id "plone" -- the same id our
CoreFixture already creates.

Re-parent a locally-built remote-library bundle onto kitconcept_FIXTURE
(new testing/robot.py holding RF_LIBRARIES) so the stock PLONE_FIXTURE is no
longer in the base chain. Also rename the distribution fixture to
distribution_name and make create_site idempotent.

GitLab: https://gitlab.kitconcept.io/kitconcept/distribution-kitconcept-intranet/-/issues/462
@ericof
ericof requested review from fredvd and sneridagh July 14, 2026 02:27
@sneridagh
sneridagh merged commit 7ef4155 into main Jul 14, 2026
12 checks passed
@sneridagh
sneridagh deleted the issue-462 branch July 14, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants