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.

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.3.0.tar.gz (9.8 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.3.0-py2.py3-none-any.whl (4.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pytest-forked-1.3.0.tar.gz.

File metadata

  • Download URL: pytest-forked-1.3.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.0

File hashes

Hashes for pytest-forked-1.3.0.tar.gz
Algorithm Hash digest
SHA256 6aa9ac7e00ad1a539c41bec6d21011332de671e938c7637378ec9710204e37ca
MD5 7de04c46b48ca5c5a24e45bf1546355f
BLAKE2b-256 62922d418d7b0c9d68a2e885b66d7f6805f9678ce56ad2b3a77669437b2d139a

See more details on using hashes here.

File details

Details for the file pytest_forked-1.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: pytest_forked-1.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.0

File hashes

Hashes for pytest_forked-1.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 dc4147784048e70ef5d437951728825a131b81714b398d5d52f17c7c144d8815
MD5 3bf024234f619cbea87b7c93388c910c
BLAKE2b-256 9d8877eeb091b4fa79f28c08718f6e6ebff5827d9d1c1dd9974218ddfbe031ee

See more details on using hashes here.

Release history Release notifications | RSS feed

1.7.5

2 files

1.6.0

2 files

1.5.0

2 files

1.4.0

2 files

This release

1.3.0 This release

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