terminal: revisit summary_failures

- get the list of reports for teardown sections only once
- do not check option in loop
This commit is contained in:
Daniel Hahler 2019-04-15 05:48:35 +02:00
parent 19035f4b55
commit 20c624efcf
1 changed files with 11 additions and 6 deletions

View File

@ -828,16 +828,21 @@ class TerminalReporter(object):
if not reports:
return
self.write_sep("=", "FAILURES")
for rep in reports:
if self.config.option.tbstyle == "line":
for rep in reports:
line = self._getcrashline(rep)
self.write_line(line)
else:
teardown_sections = {}
for report in self.getreports(""):
if report.when == "teardown":
teardown_sections.setdefault(report.nodeid, []).append(report)
for rep in reports:
msg = self._getfailureheadline(rep)
self.write_sep("_", msg, red=True, bold=True)
self._outrep_summary(rep)
for report in self.getreports(""):
if report.nodeid == rep.nodeid and report.when == "teardown":
for report in teardown_sections.get(rep.nodeid, []):
self.print_teardown_sections(report)
def summary_errors(self):