Skip to content

Commit

Permalink
Use a more specific exception type in test_raises_repr_inflight
Browse files Browse the repository at this point in the history
As requested during review
  • Loading branch information
nicoddemus committed Nov 22, 2018
1 parent b71bd9b commit 9ae8429
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions testing/python/raises.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ def __call__(self):
pass

def test_raises_repr_inflight(self):
with pytest.raises(RuntimeError) as excinfo:
"""Ensure repr() on an exception info inside a pytest.raises with block works (#4386)"""

class E(Exception):
pass

with pytest.raises(E) as excinfo:
# this test prints the inflight uninitialized object
# using repr and str as well as pprint to demonstrate
# it works
Expand All @@ -43,7 +48,7 @@ def test_raises_repr_inflight(self):
import pprint

pprint.pprint(excinfo)
raise RuntimeError(1)
raise E()

def test_raises_as_contextmanager(self, testdir):
testdir.makepyfile(
Expand Down

0 comments on commit 9ae8429

Please sign in to comment.