Skip to content

Commit e7bcc85

Browse files
authored
Merge pull request #3202 from rouge8/pytest-raises-sphinx-parameters
Add Sphinx parameter docs for `match` and `message` args to `pytest.raises()`
2 parents c04e248 + ffee213 commit e7bcc85

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

_pytest/python_api.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,10 @@ def raises(expected_exception, *args, **kwargs):
453453
Assert that a code block/function call raises ``expected_exception``
454454
and raise a failure exception otherwise.
455455
456+
:arg message: if specified, provides a custom failure message if the
457+
exception is not raised
458+
:arg match: if specified, asserts that the exception matches a text or regex
459+
456460
This helper produces a ``ExceptionInfo()`` object (see below).
457461
458462
You may use this function as a context manager::

changelog/3202.doc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add Sphinx parameter docs for ``match`` and ``message`` args to ``pytest.raises``.

0 commit comments

Comments
 (0)