--- id: pytest-reraise version: "2.1.2" license: MIT license_treatment: permissive maintenance: abandoned --- # pytest-reraise — Make multi-threaded pytest test cases fail when they should License: permissive · Maintenance: abandoned · Downloads: 180.4K/mo ## What it is and what it does pytest-reraise is a pytest plugin that solves a specific threading problem: when you write assertions inside a thread spawned from a test, those assertions fail silently because the exception is raised in the thread, not the main test thread. The plugin provides a `reraise` fixture that acts as a context manager to capture exceptions from worker threads and re-raise them in the main thread at the end of the test, making the test fail as expected. The plugin supports wrapping functions as decorators, manually triggering re-raises mid-test, handling multiple exceptions (keeping the first), optionally catching exceptions to prevent them from crashing the thread, and accessing or resetting captured exceptions. It's designed for developers writing multi-threaded tests who need pytest to properly detect assertion failures that occur in spawned threads. Use it for: - Testing concurrent code where worker threads perform assertions that must be validated by the main test - Verifying that background tasks or thread pools fail correctly when they encounter errors - Debugging multi-threaded applications by ensuring thread exceptions don't silently pass tests - Wrapping thread target functions with exception capture to keep threads alive while collecting errors - Comparing captured thread exceptions against expected error types or messages in test assertions ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Captures exceptions raised in threads during pytest tests and re-raises them in the main thread so that multi-threaded test failures are properly detected. Yes, if you actively write multi-threaded pytest tests and need thread exceptions to fail your tests. The low install friction and permissive license make adoption easy. However, the abandoned maintenance status (last commit 2023-02-06) is a concern—verify compatibility with your pytest and Python versions before relying on it for new projects, and monitor for any unresolved issues with newer releases. ## Install pip install pytest-reraise uv add pytest-reraise poetry add pytest-reraise ## Installing pytest-reraise Before you install: Low friction: pure Python wheel with only pytest as a runtime dependency. Maintenance is stalled—last commit was 2023-02-06 and the package is marked abandoned, though it remains marked Production/Stable and has received no security reports. License in practice: MIT license is permissive; you may use, modify, and distribute this package freely in commercial and private projects with minimal restrictions. Quickstart: pip install pytest-reraise # In your test file: from threading import Thread def test_with_thread(reraise): def run(): with reraise: assert False Thread(target=run).start() Verify before relying: - Whether the package works reliably with pytest versions released after 2023-02-06 - Whether the abandoned status indicates unresolved bugs or compatibility issues with newer Python or pytest releases ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: abandoned - Downloads: 180.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest thread exception handling, multi-threaded test assertions, capture exceptions in threads, pytest plugin threading, thread assertion failures, pytest reraise decorator, test thread error detection, pytest-plugin, threading, test-utilities [View on SkillFed](https://skillfed.io/packages/pytest-reraise) · [View on PyPI](https://pypi.org/project/pytest-reraise/)