Skip to content

Commit 5d2a995

Browse files
authored
[experimental] cacheprovider: store repr of reports with last-failed (#55)
This is meant to aid debugging, e.g. in case there are suddenly a lot of last-failed tests. Ref: pytest-dev#5301 Ref: #54
1 parent 9639281 commit 5d2a995

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/_pytest/cacheprovider.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,12 @@ def pytest_runtest_logreport(self, report):
191191
if (report.when == "call" and report.passed) or report.skipped:
192192
self.lastfailed.pop(report.nodeid, None)
193193
elif report.failed:
194-
self.lastfailed[report.nodeid] = True
194+
info = [repr(report)]
195+
try:
196+
info.append(str(report.longrepr.reprcrash))
197+
except AttributeError:
198+
info.append(str(report.longrepr))
199+
self.lastfailed[report.nodeid] = info
195200

196201
def pytest_collectreport(self, report):
197202
passed = report.outcome in ("passed", "skipped")

0 commit comments

Comments
 (0)