remove usage of exception module, which is gone in py3.3
This commit is contained in:
parent
e876ad9abd
commit
7f36649763
|
@ -781,7 +781,7 @@ def raises(ExpectedException, *args, **kwargs):
|
||||||
# we want to catch a AssertionError
|
# we want to catch a AssertionError
|
||||||
# replace our subclass with the builtin one
|
# replace our subclass with the builtin one
|
||||||
# see https://bitbucket.org/hpk42/pytest/issue/176/pytestraises
|
# see https://bitbucket.org/hpk42/pytest/issue/176/pytestraises
|
||||||
from exceptions import AssertionError as ExpectedException
|
from _pytest.assertion.util import BuiltinAssertionError as ExpectedException
|
||||||
|
|
||||||
if not args:
|
if not args:
|
||||||
return RaisesContext(ExpectedException)
|
return RaisesContext(ExpectedException)
|
||||||
|
|
|
@ -1422,9 +1422,9 @@ class TestRaises:
|
||||||
def test_raises_flip_builtin_AssertionError(self):
|
def test_raises_flip_builtin_AssertionError(self):
|
||||||
# we replace AssertionError on python level
|
# we replace AssertionError on python level
|
||||||
# however c code might still raise the builtin one
|
# however c code might still raise the builtin one
|
||||||
import exceptions
|
from _pytest.assertion.util import BuiltinAssertionError
|
||||||
pytest.raises(AssertionError,"""
|
pytest.raises(AssertionError,"""
|
||||||
raise exceptions.AssertionError
|
raise BuiltinAssertionError
|
||||||
""")
|
""")
|
||||||
|
|
||||||
@pytest.mark.skipif('sys.version < "2.5"')
|
@pytest.mark.skipif('sys.version < "2.5"')
|
||||||
|
|
Loading…
Reference in New Issue