Use a more specific exception type in test_raises_repr_inflight
As requested during review
This commit is contained in:
parent
b71bd9b300
commit
9ae8429a21
|
@ -34,7 +34,12 @@ class TestRaises(object):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def test_raises_repr_inflight(self):
|
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
|
# this test prints the inflight uninitialized object
|
||||||
# using repr and str as well as pprint to demonstrate
|
# using repr and str as well as pprint to demonstrate
|
||||||
# it works
|
# it works
|
||||||
|
@ -43,7 +48,7 @@ class TestRaises(object):
|
||||||
import pprint
|
import pprint
|
||||||
|
|
||||||
pprint.pprint(excinfo)
|
pprint.pprint(excinfo)
|
||||||
raise RuntimeError(1)
|
raise E()
|
||||||
|
|
||||||
def test_raises_as_contextmanager(self, testdir):
|
def test_raises_as_contextmanager(self, testdir):
|
||||||
testdir.makepyfile(
|
testdir.makepyfile(
|
||||||
|
|
Loading…
Reference in New Issue