Warnings always raised in WarningsRecorder
This ensures that if tests for warnings are run more than once, the warning is still raised as expected.
This commit is contained in:
@@ -167,3 +167,9 @@ class TestWarns(object):
|
||||
assert len(record) == 2
|
||||
assert str(record[0].message) == "user"
|
||||
assert str(record[1].message) == "runtime"
|
||||
|
||||
@pytest.mark.parametrize('run', [1, 2])
|
||||
def test_doubletest(self, run):
|
||||
"""If a test is run again, the warning should still be raised"""
|
||||
with pytest.warns(RuntimeWarning):
|
||||
warnings.warn("runtime", RuntimeWarning)
|
||||
|
||||
Reference in New Issue
Block a user