pytest-reraise
Make multi-threaded pytest test cases fail when they should
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
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 · maintenance · safety
MIT (permissive) — MIT license is permissive; you may use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
last release 2022-09-20 (1424 days) · last repo commit 2023-02-06 · 20 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 180,427 downloads/mo, #10,145 on PyPI
Alternatives
Verify before relying
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()- 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
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 on this page. Verify before relying on it.
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
pytest-reraise on PyPI
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 the current Python release >=3.6.1,<4.0.0 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepytest |
| Maintenance | Abandoned 1,424 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 180,427 / month, #10,145 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTyping :: Typed |
Evidence: pytest_reraise-2.1.2-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pytest thread exception handling”
- pytest-reraiseCaptures exceptions raised in threads during pytest tests and…
- opentelemetry-instrumentation-exceptionsAutomatically captures uncaught exceptions in your Python process,…
- pytest-threadleakA pytest plugin that detects when tests leak threads—threads that…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also outcome · pytest-assume · pytest-raises · pytest-race · re-assert · pytest-run-parallel · softest · kthread · pytest-rerunfailures · pytest-check