Skip to content

Commit 28b1896

Browse files
committed
Remove BuiltinAssertionError
We used to have this when we where patching the real Python AssertionError for use with reinterpret, but reinterpret is now gone so we no longer need this as it is not used by rewrite.
1 parent 99a4a1a commit 28b1896

3 files changed

Lines changed: 1 addition & 15 deletions

File tree

_pytest/assertion/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
except ImportError:
99
Sequence = list
1010

11-
BuiltinAssertionError = py.builtin.builtins.AssertionError
11+
1212
u = py.builtin._totext
1313

1414
# The _reprcompare attribute on the util module is used by the new assertion

_pytest/python.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,12 +1146,6 @@ def raises(expected_exception, *args, **kwargs):
11461146
11471147
"""
11481148
__tracebackhide__ = True
1149-
if expected_exception is AssertionError:
1150-
# we want to catch a AssertionError
1151-
# replace our subclass with the builtin one
1152-
# see https://github.com/pytest-dev/pytest/issues/176
1153-
from _pytest.assertion.util import BuiltinAssertionError \
1154-
as expected_exception
11551149
msg = ("exceptions must be old-style classes or"
11561150
" derived from BaseException, not %s")
11571151
if isinstance(expected_exception, tuple):

testing/python/raises.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@ def __call__(self):
2626
except pytest.raises.Exception:
2727
pass
2828

29-
def test_raises_flip_builtin_AssertionError(self):
30-
# we replace AssertionError on python level
31-
# however c code might still raise the builtin one
32-
from _pytest.assertion.util import BuiltinAssertionError # noqa
33-
pytest.raises(AssertionError,"""
34-
raise BuiltinAssertionError
35-
""")
36-
3729
def test_raises_as_contextmanager(self, testdir):
3830
testdir.makepyfile("""
3931
from __future__ import with_statement

0 commit comments

Comments
 (0)