From ea79eb5c3ff96e5dad7719650784580cd31fa0ad Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 14 Apr 2019 15:13:15 +0200 Subject: [PATCH] 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. --- changelog/5108.feature.rst | 1 + src/_pytest/terminal.py | 2 +- testing/test_terminal.py | 14 +++++++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 changelog/5108.feature.rst diff --git a/changelog/5108.feature.rst b/changelog/5108.feature.rst new file mode 100644 index 000000000..3b66ce5bf --- /dev/null +++ b/changelog/5108.feature.rst @@ -0,0 +1 @@ +The short test summary is displayed after passes with output (``-rP``). diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index 2d7132259..b8b37835f 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -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() diff --git a/testing/test_terminal.py b/testing/test_terminal.py index feacc242d..de1da0249 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -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):