Skip to main content

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.

python version ci pre-commit black

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_forked-1.7.5.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_forked-1.7.5-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file pytest_forked-1.7.5.tar.gz.

File metadata

  • Download URL: pytest_forked-1.7.5.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pytest_forked-1.7.5.tar.gz
Algorithm Hash digest
SHA256 00f2bee51612f29b8e6b81eed2c3b2975e824c2693394f5bdaf7a1369078ba5f
MD5 fa0d304ffbff03dcfa8ce5503c2d5d94
BLAKE2b-256 999298bd460b998f9ec053acba2e3efbbca12a9a408ec8648bd55abd2df784f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_forked-1.7.5.tar.gz:

Publisher: deploy.yml on pytest-dev/pytest-forked

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_forked-1.7.5-py3-none-any.whl.

File metadata

  • Download URL: pytest_forked-1.7.5-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pytest_forked-1.7.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e9f3475fa0a42927f5e370d721de9c2d785616a06a4c506712d6cb8055e37c84
MD5 66c43aade69391dbf4dc27ae902b78ab
BLAKE2b-256 18f146d32fe4b9aae09fe397e768ff376d9b6bdbb4f11faaa727f163c3457b43

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_forked-1.7.5-py3-none-any.whl:

Publisher: deploy.yml on pytest-dev/pytest-forked

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.7.5 This release

2 files

1.6.0

2 files

1.5.0

2 files

1.4.0

2 files

1.3.0

2 files

1.2.0

2 files

1.1.3

2 files

1.1.2

1 file

1.1.1

1 file

1.1.0

1 file

1.0.2

2 files

1.0.1

2 files

0.2

2 files

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