pytest-reraise is a pytest plugin designed to make multi-threaded test cases fail when exceptions occur in background threads. Without it, exceptions in threads separate from the main test thread might not be caught by pytest, leading to silently passing tests. The current version is 2.1.2, with a release cadence that focuses on bug fixes and minor feature enhancements.
pip install pytest-reraiseVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `pytest-reraise` to catch exceptions that occur in background threads. Without `Reraise.wrap()`, `pytest` would typically miss these exceptions, allowing the test to pass even if a critical error occurred in a non-main thread.
Upgrade Python to 3.6.1 or newer, or downgrade `pytest-reraise` to version `1.0.3` (`pip install "pytest-reraise<2.0.0"`).
Ensure that any function intended to run in a separate thread and whose exceptions you want pytest to catch is wrapped using `Reraise.wrap(your_function)` before passing it to `threading.Thread(target=...)`.
Upgrade `pytest-reraise` to version 2.1.1 or newer. This issue was fixed in version 2.1.1.
Run `pip install pytest-reraise` to install the package.
Upgrade your Python interpreter to 3.6.1 or newer, or downgrade `pytest-reraise` to a compatible version: `pip install "pytest-reraise<2.0.0"`.
Modify your `threading.Thread` target to explicitly wrap the function: `threading.Thread(target=Reraise.wrap(your_function_that_raises))`.