summaryrefslogtreecommitdiff
path: root/testing/test_assertion.py
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2020-02-14 02:17:05 +0100
committerGitHub <noreply@github.com>2020-02-14 02:17:05 +0100
commitd89b5057cadb8716e25b783fee8a1d670e043109 (patch)
treef0d7ddc102194cc64cd605f6fa6360529849fb12 /testing/test_assertion.py
parent83137c89e926155b9c905cc6c64c84e02ec87076 (diff)
downloadpytest-d89b5057cadb8716e25b783fee8a1d670e043109.tar.gz
assertrepr_compare: provide more info (location) with exceptions (#6728)
Diffstat (limited to 'testing/test_assertion.py')
-rw-r--r--testing/test_assertion.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/testing/test_assertion.py b/testing/test_assertion.py
index 0c0f12340..cf80fba43 100644
--- a/testing/test_assertion.py
+++ b/testing/test_assertion.py
@@ -677,8 +677,16 @@ class TestAssert_reprcompare:
expl = callequal([], [A()])
assert "ValueError" in "".join(expl)
- expl = callequal({}, {"1": A()})
- assert "faulty" in "".join(expl)
+ expl = callequal({}, {"1": A()}, verbose=2)
+ assert expl[0].startswith("{} == <[ValueError")
+ assert "raised in repr" in expl[0]
+ assert expl[1:] == [
+ "(pytest_assertion plugin: representation of details failed:"
+ " {}:{}: ValueError: 42.".format(
+ __file__, A.__repr__.__code__.co_firstlineno + 1
+ ),
+ " Probably an object has a faulty __repr__.)",
+ ]
def test_one_repr_empty(self):
"""