Registry / testing / pytest-raises

pytest-raises

JSON →
library0.11pypypiunverified

pytest-raises provides a `@pytest.mark.raises` decorator as an alternative to `pytest.raises` context manager. Current version 0.11 (no recent releases). Use is discouraged in favor of the built-in `pytest.raises` for new projects.

pip install pytest-raises
INSTALL
IMPORT
SIG · PYTEST-RAISES
P
pytest-raises
testingpythonv0.11
Install
2.8s avg
Import
Disk
29MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.11 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 30.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.8s · import 0.000s · 31MB
29MB installed
● package 29MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytest.mark.raises
pytest.mark.raises (no import needed)
The marker is registered automatically via plugin; no explicit import required.

Use @pytest.mark.raises to assert an exception is raised.

@pytest.mark.raises(ValueError, match='invalid') def test_raises(): raise ValueError('invalid value')
Debug
Known issues
deprecatedpytest-raises is no longer actively maintained. Prefer `pytest.raises` context manager or other mechanisms.
fix
Rewrite using `with pytest.raises(ValueError): ...`
affects: all
gotcha`@pytest.mark.raises` cannot use `pytest.param` or parametrization with the raises marker directly. The marker is applied to the whole function, not per-parametrization.
fix
Use `pytest.raises` inside a parametrized test function.
affects: all
gotchaIf the test function does not raise the expected exception, the test fails with a custom error message from the plugin, not the usual `Failed: DID NOT RAISE` format. This can confuse CI log parsers.
fix
Switch to built-in `pytest.raises` for consistent error messages.
affects: all
Upgrade
Version history
0.11latest on PyPI · released Apr 23, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
pytest-raises — pip install pytest-raises · libregistry