Overview

pytest-boxed: running tests in forked subprocesses

The `pytest-boxed`_ plugin extends py.test wit the --boxed execution mode. It will run each test in a boxed_ subprocess to survive SEGFAULTS or otherwise dying processes

Running tests in a boxed subprocess

If you have tests involving C or C++ libraries you might have to deal with tests crashing the process. For this case you max use the boxing options:

py.test --boxed

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 to speed up the test run and use your CPU cores:

py.test -n3 --boxed

this would run 3 testing subprocesses in parallel which each create new boxed subprocesses for each test. (needs pytest-xdist)