diff --git a/doc/en/how-to/capture-warnings.rst b/doc/en/how-to/capture-warnings.rst index ae76b5bce..1a3d1873c 100644 --- a/doc/en/how-to/capture-warnings.rst +++ b/doc/en/how-to/capture-warnings.rst @@ -268,7 +268,7 @@ argument ``match`` to assert that the exception matches a text or regex:: ... warnings.warn("this is not here", UserWarning) Traceback (most recent call last): ... - Failed: DID NOT WARN. No warnings of type ...UserWarning... was emitted... + Failed: DID NOT WARN. No warnings of type ...UserWarning... were emitted... You can also call :func:`pytest.warns` on a function or code string: diff --git a/src/_pytest/recwarn.py b/src/_pytest/recwarn.py index 950d853f5..175b571a8 100644 --- a/src/_pytest/recwarn.py +++ b/src/_pytest/recwarn.py @@ -136,7 +136,7 @@ def warns( ... warnings.warn("this is not here", UserWarning) Traceback (most recent call last): ... - Failed: DID NOT WARN. No warnings of type ...UserWarning... was emitted... + Failed: DID NOT WARN. No warnings of type ...UserWarning... were emitted... """ __tracebackhide__ = True @@ -274,7 +274,7 @@ class WarningsChecker(WarningsRecorder): if not any(issubclass(r.category, self.expected_warning) for r in self): __tracebackhide__ = True fail( - "DID NOT WARN. No warnings of type {} was emitted. " + "DID NOT WARN. No warnings of type {} were emitted. " "The list of emitted warnings is: {}.".format( self.expected_warning, [each.message for each in self] ) @@ -287,7 +287,7 @@ class WarningsChecker(WarningsRecorder): else: fail( "DID NOT WARN. No warnings of type {} matching" - " ('{}') was emitted. The list of emitted warnings" + " ('{}') were emitted. The list of emitted warnings" " is: {}.".format( self.expected_warning, self.match_expr, diff --git a/testing/test_recwarn.py b/testing/test_recwarn.py index b82fd9a86..d3f218f16 100644 --- a/testing/test_recwarn.py +++ b/testing/test_recwarn.py @@ -263,7 +263,7 @@ class TestWarns: with pytest.warns(RuntimeWarning): warnings.warn("user", UserWarning) excinfo.match( - r"DID NOT WARN. No warnings of type \(.+RuntimeWarning.+,\) was emitted. " + r"DID NOT WARN. No warnings of type \(.+RuntimeWarning.+,\) were emitted. " r"The list of emitted warnings is: \[UserWarning\('user',?\)\]." ) @@ -271,7 +271,7 @@ class TestWarns: with pytest.warns(UserWarning): warnings.warn("runtime", RuntimeWarning) excinfo.match( - r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) was emitted. " + r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) were emitted. " r"The list of emitted warnings is: \[RuntimeWarning\('runtime',?\)\]." ) @@ -279,7 +279,7 @@ class TestWarns: with pytest.warns(UserWarning): pass excinfo.match( - r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) was emitted. " + r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) were emitted. " r"The list of emitted warnings is: \[\]." ) @@ -290,7 +290,7 @@ class TestWarns: warnings.warn("import", ImportWarning) message_template = ( - "DID NOT WARN. No warnings of type {0} was emitted. " + "DID NOT WARN. No warnings of type {0} were emitted. " "The list of emitted warnings is: {1}." ) excinfo.match(