{"id":21809,"library":"pytest-raises","title":"pytest-raises","description":"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.","status":"maintenance","version":"0.11","language":"python","source_language":"en","source_url":"https://github.com/Authentise/pytest-raises","tags":["pytest","plugin","exceptions","testing","raises"],"install":[{"cmd":"pip install pytest-raises","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"The marker is registered automatically via plugin; no explicit import required.","symbol":"pytest.mark.raises","correct":"pytest.mark.raises (no import needed)"}],"quickstart":{"code":"@pytest.mark.raises(ValueError, match='invalid')\ndef test_raises():\n    raise ValueError('invalid value')","lang":"python","description":"Use @pytest.mark.raises to assert an exception is raised."},"warnings":[{"fix":"Rewrite using `with pytest.raises(ValueError): ...`","message":"pytest-raises is no longer actively maintained. Prefer `pytest.raises` context manager or other mechanisms.","severity":"deprecated","affected_versions":"all"},{"fix":"Use `pytest.raises` inside a parametrized test function.","message":"`@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.","severity":"gotcha","affected_versions":"all"},{"fix":"Switch to built-in `pytest.raises` for consistent error messages.","message":"If 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.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install pytest-raises: `pip install pytest-raises`","cause":"pytest-raises plugin not installed or enabled.","error":"AttributeError: module 'pytest' has no attribute 'mark'"},{"fix":"Ensure the test raises the exception, or use `pytest.raises(ValueError)` for better error context.","cause":"The test did not raise the expected exception.","error":"Failed: DID NOT RAISE <class 'ValueError'>"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}