summaryrefslogtreecommitdiff
path: root/testing/code
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-10-23 06:59:18 +0200
committerDaniel Hahler <git@thequod.de>2019-11-06 22:08:10 +0100
commiteb7a4e32ad920b4cdd9c956763535fed194ae8a7 (patch)
tree3a111410860e9ff9742fdfbe73140bcbf6c4add2 /testing/code
parent5be3a9b5cee3ef73b627049272db5bd2e34f5026 (diff)
downloadpytest-eb7a4e32ad920b4cdd9c956763535fed194ae8a7.tar.gz
saferepr: handle BaseExceptions
This causes INTERNALERRORs with pytest-django, which uses `pytest.fail` (derived from `BaseException`) to prevent DB access, when pytest then tries to e.g. display the `repr()` for a Django `QuerySet` etc. Ref: https://github.com/pytest-dev/pytest-django/pull/776
Diffstat (limited to 'testing/code')
-rw-r--r--testing/code/test_excinfo.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/testing/code/test_excinfo.py b/testing/code/test_excinfo.py
index b431bb66d..262d1d184 100644
--- a/testing/code/test_excinfo.py
+++ b/testing/code/test_excinfo.py
@@ -584,7 +584,7 @@ raise ValueError()
reprlocals = p.repr_locals(loc)
assert reprlocals.lines
assert reprlocals.lines[0] == "__builtins__ = <builtins>"
- assert '[NotImplementedError("") raised in repr()]' in reprlocals.lines[1]
+ assert "[NotImplementedError() raised in repr()]" in reprlocals.lines[1]
def test_repr_local_with_exception_in_class_property(self):
class ExceptionWithBrokenClass(Exception):
@@ -602,7 +602,7 @@ raise ValueError()
reprlocals = p.repr_locals(loc)
assert reprlocals.lines
assert reprlocals.lines[0] == "__builtins__ = <builtins>"
- assert '[ExceptionWithBrokenClass("") raised in repr()]' in reprlocals.lines[1]
+ assert "[ExceptionWithBrokenClass() raised in repr()]" in reprlocals.lines[1]
def test_repr_local_truncated(self):
loc = {"l": [i for i in range(10)]}