Skip to content

Commit

Permalink
Add a test when multiple classes are specified in warns
Browse files Browse the repository at this point in the history
  • Loading branch information
lesteve committed Dec 29, 2016
1 parent 6173120 commit fa418c9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions testing/test_recwarn.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,17 @@ def test_record_by_subclass(self):
assert str(record[0].message) == "user"
assert str(record[1].message) == "runtime"

class MyUserWarning(UserWarning): pass
class MyRuntimeWarning(RuntimeWarning): pass

with pytest.warns((UserWarning, RuntimeWarning)) as record:
warnings.warn("user", MyUserWarning)
warnings.warn("runtime", MyRuntimeWarning)

assert len(record) == 2
assert str(record[0].message) == "user"
assert str(record[1].message) == "runtime"


def test_double_test(self, testdir):
"""If a test is run again, the warning should still be raised"""
Expand Down

0 comments on commit fa418c9

Please sign in to comment.