From e5b527d0e3d72cf8e2cac4a4f7fb7b9a2d2f6e06 Mon Sep 17 00:00:00 2001 From: Andy Freeland Date: Fri, 9 Feb 2018 16:25:00 -0800 Subject: [PATCH 1/2] Add Sphinx parameter docs for `match` and `message` args to `pytest.raises()` --- _pytest/python_api.py | 4 ++++ changelog/3202.trivial.rst | 1 + 2 files changed, 5 insertions(+) create mode 100644 changelog/3202.trivial.rst diff --git a/_pytest/python_api.py b/_pytest/python_api.py index 81960295b38..e6f002849d5 100644 --- a/_pytest/python_api.py +++ b/_pytest/python_api.py @@ -453,6 +453,10 @@ def raises(expected_exception, *args, **kwargs): Assert that a code block/function call raises ``expected_exception`` and raise a failure exception otherwise. + :arg message: if specified, provides a custom failure message if the + exception is not raised + :arg match: if specified, asserts that the exception matches a text or regex + This helper produces a ``ExceptionInfo()`` object (see below). You may use this function as a context manager:: diff --git a/changelog/3202.trivial.rst b/changelog/3202.trivial.rst new file mode 100644 index 00000000000..767a32b4258 --- /dev/null +++ b/changelog/3202.trivial.rst @@ -0,0 +1 @@ +Add Sphinx parameter docs for ``match`` and ``message`` args to :func:`pytest.raises`. From ffee213c85a39a7aa60ae84cb6badfb583fecba1 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 9 Feb 2018 22:51:15 -0200 Subject: [PATCH 2/2] Update and rename 3202.trivial.rst to 3202.doc.rst --- changelog/{3202.trivial.rst => 3202.doc.rst} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename changelog/{3202.trivial.rst => 3202.doc.rst} (73%) diff --git a/changelog/3202.trivial.rst b/changelog/3202.doc.rst similarity index 73% rename from changelog/3202.trivial.rst rename to changelog/3202.doc.rst index 767a32b4258..a6f99fbf63a 100644 --- a/changelog/3202.trivial.rst +++ b/changelog/3202.doc.rst @@ -1 +1 @@ -Add Sphinx parameter docs for ``match`` and ``message`` args to :func:`pytest.raises`. +Add Sphinx parameter docs for ``match`` and ``message`` args to ``pytest.raises``.