This plugin does not work on Windows because there’s no fork support.
--forked: run each test in a forked subprocess to survive SEGFAULTS or otherwise dying processes.
Installation
Install the plugin with:
pip install pytest-forked
or use the package in develope/in-place mode with a checkout of the pytest-forked repository
pip install -e .
Usage examples
If you have tests involving C or C++ libraries you might have to deal with tests crashing the process. For this case you may use the boxing options:
pytest --forked
which will run each test in a subprocess and will report if a test crashed the process. You can also combine this option with running multiple processes via pytest-xdist to speed up the test run and use your CPU cores:
pytest -n3 --forked
this would run 3 testing subprocesses in parallel which each create new forked subprocesses for each test.
You can also fork for individual tests:
@pytest.mark.forked
def test_with_leaky_state():
run_some_monkey_patches()
This test will be unconditionally boxed, regardless of CLI flag.
Metadata
Release files for pytest-forked 1.7.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pytest_forked-1.7.5.tar.gz | 13.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_forked-1.7.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.3 kB
Release files / pytest_forked-1.7.5.tar.gz
| Download URL | pytest_forked-1.7.5.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00f2bee51612f29b8e6b81eed2c3b2975e824c2693394f5bdaf7a1369078ba5f
|
|
BLAKE2b-256 checksum How to use checksums |
999298bd460b998f9ec053acba2e3efbbca12a9a408ec8648bd55abd2df784f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 8, 2026.
Transparency logRelease files / pytest_forked-1.7.5-py3-none-any.whl
| Download URL | pytest_forked-1.7.5-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9f3475fa0a42927f5e370d721de9c2d785616a06a4c506712d6cb8055e37c84
|
|
BLAKE2b-256 checksum How to use checksums |
18f146d32fe4b9aae09fe397e768ff376d9b6bdbb4f11faaa727f163c3457b43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 8, 2026.
Transparency logSecurity for pytest-forked 1.7.5
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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for pytest_forked-1.7.5.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 Aug 8, 2026.
Transparency logA 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.