Add a Testing chapter for backend packages#2094
Open
jensens wants to merge 3 commits into
Open
Conversation
Plone 6 has no backend testing documentation. The Developer guide has no Testing section, and the only rendered HTML for plone.testing and plone.app.testing lives on the legacy 5.docs.plone.org domain. @davisagli sketched a full outline for such a chapter in a comment on plone/pytest-plone#16 two years ago. This picks up the two pieces of it that cover backend Python testing, and deliberately leaves the rest -- Volto, Robot Framework, testbrowser -- to build on top. - conceptual-guides/testing.md explains the kinds of tests, why Plone has testing layers at all, and how to choose between the two runners. - developer-guide/testing/ shows how to write and run tests with either zope.testrunner or pytest. The pytest guide links to the published pytest-plone documentation at plone.github.io/pytest-plone. Volto testing is cross-referenced rather than duplicated: it lives in the Volto repository. Every zope-testrunner command shown was executed against a real package before being documented. Vale reports 0 errors, 0 warnings, and 0 suggestions on the new pages; linkcheck confirms every external link resolves.
Writing the testing.py layer is the setup work both zope.testrunner and pytest-plone build on, and the chapter previously punted it to the large plone.app.testing README. That left the developer guide without its keystone: the one thing every backend test needs. Add developer-guide/testing/write-a-testing-layer.md, placed first in the sub-toctree because it is the shared prerequisite. It shows both forms: - the declarative PloneWithPackageLayer instance, for a simple add-on; - the PloneSandboxLayer subclass with setUpZope/setUpPloneSite, for anything more involved. Both forms, and the WSGI_SERVER_FIXTURE note for real-HTTP functional tests, are taken from real coredev packages (plone.app.dexterity, plone.volto) and the plone.app.testing README, and every import was checked against the installed packages. The runner guides and the conceptual guide now point here instead of at the README. Also drop the code-span from the zope.testrunner headings, which rendered as a heavy monospace box next to the plain 'pytest' heading.
gforcada
reviewed
Jul 17, 2026
- Sort the Vale vocabulary additions into place instead of appending them, and trim them to the terms actually needed (the class names only ever appear in code spans, which Vale does not check). - Do not pin Cypress for the Volto frontend; the frontend tooling is in flux, so defer to the Volto documentation instead. - Recommend 'zope-testrunner --test-path src -s <pkg>', the form the plone.meta tox environments use, and keep --auto-path as the pip-installed alternative. (Thanks @gforcada -- the original --auto-path lead came from buildout.coredev's run-tests.sh, not the common case.) - Note that pytest --cov needs the pytest-cov plugin installed. - Backtick pytest in the 'Choosing' section for consistency with zope.testrunner.
Member
Author
|
Thanks for the review, @gforcada! All five addressed in the last commit:
Vale is back to 0/0/0 on the five pages. |
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.
Why
Plone 6 has no backend testing documentation. The Developer guide has no Testing section (only Volto testing, under Contributing), and the only rendered HTML for
plone.testingandplone.app.testinglives on the legacy5.docs.plone.orgdomain.@davisagli sketched a full outline for such a chapter in a comment on plone/pytest-plone#16 about two years ago, covering Volto/Jest/Cypress, unittest/
zope.testrunner, pytest, Robot, and testbrowser. This PR picks up the two pieces of that outline that cover backend Python testing and deliberately leaves the rest to build on top. Please treat the structure as a starting point — I expect there are opinions on placement, and I am happy to move things.What
Five pages, Diataxis-classified:
Explanation —
conceptual-guides/testing.md: The kinds of tests (unit / integration / functional / acceptance), why Plone has testing layers at all, and how to choose between the two runners.
How-to —
developer-guide/testing/: -
write-a-testing-layer.md— the keystone, placed first: writing thetesting.pylayer both runners share. Shows the declarativePloneWithPackageLayerform for simple add-ons and thePloneSandboxLayersubclass form for complex ones.: -
zope-testrunner.md— write and run tests withunittestandzope.testrunner.: -
pytest.md— write and run tests with pytest, linking to the published pytest-plone documentation.Scope
plone.app.testing/plone.testing; the how-to links there rather than reproducing it.Verification
zope-testrunnercommand shown was executed against a real package. The two layer forms are taken from real coredev packages (plone.app.dexterity,plone.volto) and theplone.app.testingREADME, with every import checked against the installed packages.make htmlproduces no new warnings, andlinkcheckfinds no broken links on the new pages.Related
Companion to the newly published pytest-plone documentation (plone/pytest-plone#56), which this chapter's pytest guide links to.