From 7f36649763bec2cbfec3d27043f67e03f3a261fe Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 28 Aug 2012 16:35:06 -0400 Subject: [PATCH] remove usage of exception module, which is gone in py3.3 --- _pytest/python.py | 2 +- testing/test_python.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_pytest/python.py b/_pytest/python.py index c67cafbdf..edb61a457 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -781,7 +781,7 @@ def raises(ExpectedException, *args, **kwargs): # we want to catch a AssertionError # replace our subclass with the builtin one # 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: return RaisesContext(ExpectedException) diff --git a/testing/test_python.py b/testing/test_python.py index c97810514..9960fe700 100644 --- a/testing/test_python.py +++ b/testing/test_python.py @@ -1422,9 +1422,9 @@ class TestRaises: def test_raises_flip_builtin_AssertionError(self): # we replace AssertionError on python level # however c code might still raise the builtin one - import exceptions + from _pytest.assertion.util import BuiltinAssertionError pytest.raises(AssertionError,""" - raise exceptions.AssertionError + raise BuiltinAssertionError """) @pytest.mark.skipif('sys.version < "2.5"')