pytest-plone
pytest-plone is a pytest plugin providing fixtures and helpers to test Plone add-ons.
It builds on zope.pytestlayer, turning the plone.testing layers you already have into pytest fixtures.
📖 Documentation: plone.github.io/pytest-plone
Installation
pip install pytest-plone
Quickstart
In your top-level conftest.py, import your testing layers and hand them to fixtures_factory with a prefix for each:
from my.addon.testing import MY_ADDON_FUNCTIONAL_TESTING
from my.addon.testing import MY_ADDON_INTEGRATION_TESTING
from pytest_plone import fixtures_factory
pytest_plugins = ["pytest_plone"]
globals().update(
fixtures_factory((
(MY_ADDON_FUNCTIONAL_TESTING, "functional"),
(MY_ADDON_INTEGRATION_TESTING, "integration"),
))
)
Then write tests as plain functions that ask for what they need:
def test_portal_title(portal):
assert portal.title == "Plone site"
Run them with pytest.
The documentation covers the rest:
- Write your first test — a guided start for a new add-on.
- How-to guides — set up the plugin, test add-on install, test a REST API, speed up a slow suite.
- Fixtures reference — every fixture, the
@pytest.mark.portalmarker, and thefixtures_factoryAPI. - Testing layers, scopes, and isolation — how it all fits together.
Contributing
You need a working Python environment, version 3.10 or later.
Install a development environment and run the tests with:
make install
make test
By default the tests run against the latest Plone version in the 6.x series.
Documentation is built with:
make docs
License
The project is licensed under the GPLv2.
Metadata
Release files for pytest-plone 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_plone-1.1.1.tar.gz | 69.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_plone-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 95.7 kB
Release files / pytest_plone-1.1.1.tar.gz
| Download URL | pytest_plone-1.1.1.tar.gz |
|---|---|
| Size | 69.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3cf102a86cdfcfb74e133c7a9331b40f46eacefead8f33c7bff23a2dea52b06d
|
|
BLAKE2b-256 checksum How to use checksums |
648976be9bdf0a7bfc23ec56cf572ed558b4610d2a00a9b6f96d55f70f529965
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / pytest_plone-1.1.1-py3-none-any.whl
| Download URL | pytest_plone-1.1.1-py3-none-any.whl |
|---|---|
| Size | 26.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f5cdae83489ad80b8fc9a804a893a2439362129c7b3d3d4d600b2923f1f14551
|
|
BLAKE2b-256 checksum How to use checksums |
b5de7e961e67f9a4a4f85400d148a919797086e7528760c4133227fc85f54801
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|