Display "short test summary info" after (main) warnings again
Fixes https://github.com/pytest-dev/pytest/issues/3952.
This commit is contained in:
@@ -647,9 +647,11 @@ class TerminalReporter(object):
|
||||
def pytest_terminal_summary(self):
|
||||
self.summary_errors()
|
||||
self.summary_failures()
|
||||
yield
|
||||
self.summary_warnings()
|
||||
yield
|
||||
self.summary_passes()
|
||||
# Display any extra warnings from teardown here (if any).
|
||||
self.summary_warnings()
|
||||
|
||||
def pytest_keyboard_interrupt(self, excinfo):
|
||||
self._keyboardinterrupt_memo = excinfo.getrepr(funcargs=True)
|
||||
@@ -726,11 +728,19 @@ class TerminalReporter(object):
|
||||
if not all_warnings:
|
||||
return
|
||||
|
||||
final = hasattr(self, "_already_displayed_warnings")
|
||||
if final:
|
||||
warnings = all_warnings[self._already_displayed_warnings :]
|
||||
else:
|
||||
warnings = all_warnings
|
||||
self._already_displayed_warnings = len(warnings)
|
||||
|
||||
grouped = itertools.groupby(
|
||||
all_warnings, key=lambda wr: wr.get_location(self.config)
|
||||
warnings, key=lambda wr: wr.get_location(self.config)
|
||||
)
|
||||
|
||||
self.write_sep("=", "warnings summary", yellow=True, bold=False)
|
||||
title = "warnings summary (final)" if final else "warnings summary"
|
||||
self.write_sep("=", title, yellow=True, bold=False)
|
||||
for location, warning_records in grouped:
|
||||
# legacy warnings show their location explicitly, while standard warnings look better without
|
||||
# it because the location is already formatted into the message
|
||||
|
||||
Reference in New Issue
Block a user