Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
plone.distributionsupport to pytest-plone: fixtures to create a Plone site from a distribution in tests.New fixtures
create_sitefunc(app, answers) -> PloneSitethat creates a new site from a distribution, deleting any existing site with the samesite_idfirst, and sets it as the current local site.distribution_name"testing"). Override in yourconftest.py.answerssite_logosite_logoanswer.site_owner_name/site_owner_passwordSITE_OWNER_NAME/SITE_OWNER_PASSWORD, so tests and fixtures can depend on them instead of importing the constants.create_siteuses the privateplone.distribution.api.site._create_siteto 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
SiteCreatorProtocol in_types.py(callable-fixture return type, following the existing convention).Dependencies
plone.distribution,plone.exportimportplone.app.caching,plone.volto— required because thetestingdistribution fromplone.distribution.testing(used to exercisecreate_site) applies their GenericSetup profiles.Testing
tests/fixtures/test_distribution.py: default-value checks for the helper fixtures, andcreate_sitefunctional tests (site created + idempotent re-create) against thetestingdistribution loaded fromplone.distribution.testing.uvx mypy srcclean,ruffcleannews/58.featureaddedCloses #58