Skip to main content

pytest-persistence

Pytest plugin for persistent fixtures.

Installation

In a Python environment do:

python -m pip install pytest-persistence

Usage

To store fixtures to file run tests with --store {file_path}:

python -m pytest --store {file_path}

To load fixtures from file run tests with --load {file_path}:

python -m pytest --load {file_path}

BEWARE When this plugin is in use cleanup of all the fixtures is not executed. This is necessary to successfully run tests with --load. However it is important to keep this fact in mind.

Excluding Fixtures

You can exclude specific fixtures from persistence using the @pytest_persistence.exclude decorator:

import pytest
import pytest_persistence

@pytest_persistence.exclude
@pytest.fixture
def non_persistent_fixture():
    return expensive_operation()

When a fixture is excluded:

  • It will not be stored during --store
  • It will be recreated during --load (parent fixtures will be loaded from file)
  • All dependent fixtures are automatically excluded
  • A warning is shown for implicitly excluded fixtures

Example with Dependencies

import pytest
from pytest_persistence import exclude

@exclude
@pytest.fixture
def excluded_fixture():
    return "excluded"

@pytest.fixture
def dependent_fixture(excluded_fixture):
    return f"depends on {excluded_fixture}"

@pytest.fixture  
def another_dependent(dependent_fixture):
    return f"also depends: {dependent_fixture}"

When running with --store, you'll see:

Warning: Fixture 'dependent_fixture' excluded due to dependency on excluded fixture 'excluded_fixture'
Warning: Fixture 'another_dependent' excluded due to dependency on excluded fixture 'dependent_fixture'

Metadata

Release files for pytest-persistence 0.1.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-persistence 0.1.12
File Size Uploaded Provenance Actions
pytest_persistence-0.1.12.tar.gz 10.1 kB With provenance Details for pytest_persistence-0.1.12.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytest-persistence 0.1.12
File Interpreter ABI Platform Actions
pytest_persistence-0.1.12-py3-none-any.whl Python 3 none any Details for pytest_persistence-0.1.12-py3-none-any.whl

Total release size: 17.8 kB

Release files / pytest_persistence-0.1.12.tar.gz

Download URL pytest_persistence-0.1.12.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8fe4fbb792929a78f3b6e30cfde2c033843218ccf16a468642520c14346e43ee
BLAKE2b-256 checksum
How to use checksums
de0090d1f0f64fc1d8b206c3d3efe0945c2f8f05070548b3331bca8269d45134
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / pytest_persistence-0.1.12-py3-none-any.whl

Download URL pytest_persistence-0.1.12-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cda909a6448ec512689f6eb678472ba55e34d4353aa35dda47dbc3973520346f
BLAKE2b-256 checksum
How to use checksums
dbc932da9af88efce9ef73979fb0fe9ce7830d4c74583be26b04d2c52b432bfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Security for pytest-persistence 0.1.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pytest_persistence-0.1.12.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page