Skip to content

Commit 1c9bd92

Browse files
Merge pull request #1913 from flub/builtin-assertion
Remove BuiltinAssertionError
2 parents 98ac1dd + 28b1896 commit 1c9bd92

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
@@ -1158,12 +1158,6 @@ def raises(expected_exception, *args, **kwargs):
11581158
11591159
"""
11601160
__tracebackhide__ = True
1161-
if expected_exception is AssertionError:
1162-
# we want to catch a AssertionError
1163-
# replace our subclass with the builtin one
1164-
# see https://github.com/pytest-dev/pytest/issues/176
1165-
from _pytest.assertion.util import BuiltinAssertionError \
1166-
as expected_exception
11671161
msg = ("exceptions must be old-style classes or"
11681162
" derived from BaseException, not %s")
11691163
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)