terminal summary: display passes after warnings

This displays passes (with output, `-rP`) before the short summary, and
before any other output from other plugins also.
This commit is contained in:
Daniel Hahler 2019-04-14 15:13:15 +02:00
parent 19035f4b55
commit ea79eb5c3f
3 changed files with 13 additions and 4 deletions

View File

@ -0,0 +1 @@
The short test summary is displayed after passes with output (``-rP``).

View File

@ -684,9 +684,9 @@ class TerminalReporter(object):
self.summary_errors()
self.summary_failures()
self.summary_warnings()
self.summary_passes()
yield
self.short_test_summary()
self.summary_passes()
# Display any extra warnings from teardown here (if any).
self.summary_warnings()

View File

@ -769,11 +769,19 @@ def test_pass_output_reporting(testdir):
assert "test_pass_has_output" not in s
assert "Four score and seven years ago..." not in s
assert "test_pass_no_output" not in s
result = testdir.runpytest("-rP")
result = testdir.runpytest("-rPp")
result.stdout.fnmatch_lines(
["*test_pass_has_output*", "Four score and seven years ago..."]
[
"*= PASSES =*",
"*_ test_pass_has_output _*",
"*- Captured stdout call -*",
"Four score and seven years ago...",
"*= short test summary info =*",
"PASSED test_pass_output_reporting.py::test_pass_has_output",
"PASSED test_pass_output_reporting.py::test_pass_no_output",
"*= 2 passed in *",
]
)
assert "test_pass_no_output" not in result.stdout.str()
def test_color_yes(testdir):