Skip to content

Add plone.distribution support#60

Merged
ericof merged 1 commit into
mainfrom
issue-58
Jul 13, 2026
Merged

Add plone.distribution support#60
ericof merged 1 commit into
mainfrom
issue-58

Conversation

@ericof

@ericof ericof commented Jul 13, 2026

Copy link
Copy Markdown
Member

What

Adds plone.distribution support to pytest-plone: fixtures to create a Plone site from a distribution in tests.

New fixtures

Fixture Scope Description
create_site session Callable func(app, answers) -> PloneSite that creates a new site from a distribution, deleting any existing site with the same site_id first, and sets it as the current local site.
distribution_name session Name of the distribution to create sites from (default "testing"). Override in your conftest.py.
answers session Mapping of answers passed to the distribution handler (site id, title, language, ...). Override to customize.
site_logo session Data-URI logo used as the site_logo answer.
site_owner_name / site_owner_password session Accessors for SITE_OWNER_NAME / SITE_OWNER_PASSWORD, so tests and fixtures can depend on them instead of importing the constants.

create_site uses the private plone.distribution.api.site._create_site to avoid committing, so the testing layer still isolates each test. The created site coexists with the site provided by the testing layer (a second site, by design).

Types

Adds a SiteCreator Protocol in _types.py (callable-fixture return type, following the existing convention).

Dependencies

  • Runtime: plone.distribution, plone.exportimport
  • Test: plone.app.caching, plone.volto — required because the testing distribution from plone.distribution.testing (used to exercise create_site) applies their GenericSetup profiles.

Testing

  • New tests/fixtures/test_distribution.py: default-value checks for the helper fixtures, and create_site functional tests (site created + idempotent re-create) against the testing distribution loaded from plone.distribution.testing.
  • Full suite: 82 passed
  • uvx mypy src clean, ruff clean
  • news/58.feature added

Closes #58

Add a create_site fixture that creates a Plone site from a
plone.distribution distribution, plus overridable distribution_name,
answers, and site_logo fixtures, and session-scoped site_owner_name /
site_owner_password fixtures. create_site uses the private _create_site
to avoid committing so the testing layer still isolates each test.

Tests exercise create_site against the "testing" distribution from
plone.distribution.testing; plone.app.caching and plone.volto are added
as test dependencies since that distribution applies their profiles.

Closes #58
@ericof
ericof merged commit 03b8182 into main Jul 13, 2026
17 checks passed
@ericof
ericof deleted the issue-58 branch July 13, 2026 19:03
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.

Add plone.distribution support

1 participant