We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6173120 commit fa418c9Copy full SHA for fa418c9
testing/test_recwarn.py
@@ -247,6 +247,17 @@ def test_record_by_subclass(self):
247
assert str(record[0].message) == "user"
248
assert str(record[1].message) == "runtime"
249
250
+ class MyUserWarning(UserWarning): pass
251
+ class MyRuntimeWarning(RuntimeWarning): pass
252
+
253
+ with pytest.warns((UserWarning, RuntimeWarning)) as record:
254
+ warnings.warn("user", MyUserWarning)
255
+ warnings.warn("runtime", MyRuntimeWarning)
256
257
+ assert len(record) == 2
258
+ assert str(record[0].message) == "user"
259
+ assert str(record[1].message) == "runtime"
260
261
262
def test_double_test(self, testdir):
263
"""If a test is run again, the warning should still be raised"""
0 commit comments