Skip to main content

No project description provided

Project description


Python package

PyPI - Version PyPI - Python Version

Isolate each test in a subprocess - pytest forked replacement, based on pytest-forked.

This pytest plugin was generated with Cookiecutter along with @hackebrot's cookiecutter-pytest-plugin template.


  • Run each test in an forked, isolated subprocess
  • Captures stdout & stderr of crashing processes
  • Add Timeout to a forked test
  • Limit memory used by test
  • Plays nice with pytest-xdist
  • Shows warnings, even with xdist!


  • pytest


You can install "pytest-isolate" via pip from PyPI

pip install pytest-isolate


pytest --isolate

To run every test in its own forked subprocess.


pytest --isolate-timeout 10 --isolate-mem-limit 1000000

To set a timeout to every test in addition to forking.


Since this plugin uses fork, it will not work on operating systems without fork support (e.g. Windows).

The flags --timeout or --forked will also be respected such that pytest-isolate is a drop-in replacement forked pytest forked and pytest timeout.

If pytest-forked or pytest-timeout are installed, then they will take precedence. Uninstall them to use pytest-isolate.

Unlike pytest-timeout, timeout in pytest-isolate is implemented by forking the test to a separate subprocess, and setting timeout for that subprocess.

You can also use a mark to isolate or time limit the memory test:

def test_something():

The options can also be set in an pytest configuration file, e.g:



Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.


Distributed under the terms of the MIT, pytest-isolate is free and open source software


If you encounter any problems, please file an issue along with a detailed description.

Download files

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

Source Distribution

pytest_isolate-0.0.2.tar.gz (8.7 kB view hashes)

Uploaded source

Built Distribution

pytest_isolate-0.0.2-py3-none-any.whl (7.8 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page