Merge pull request #4040 from ods/summary_passes_less_noisy
Exclude empty reports for passed tests
This commit is contained in:
commit
2d06927a06
|
@ -0,0 +1 @@
|
||||||
|
Exclude empty reports for passed tests when ``-rP`` option is used.
|
|
@ -745,6 +745,7 @@ class TerminalReporter(object):
|
||||||
return
|
return
|
||||||
self.write_sep("=", "PASSES")
|
self.write_sep("=", "PASSES")
|
||||||
for rep in reports:
|
for rep in reports:
|
||||||
|
if rep.sections:
|
||||||
msg = self._getfailureheadline(rep)
|
msg = self._getfailureheadline(rep)
|
||||||
self.write_sep("_", msg)
|
self.write_sep("_", msg)
|
||||||
self._outrep_summary(rep)
|
self._outrep_summary(rep)
|
||||||
|
|
|
@ -681,14 +681,22 @@ def test_pass_reporting_on_fail(testdir):
|
||||||
def test_pass_output_reporting(testdir):
|
def test_pass_output_reporting(testdir):
|
||||||
testdir.makepyfile(
|
testdir.makepyfile(
|
||||||
"""
|
"""
|
||||||
def test_pass_output():
|
def test_pass_has_output():
|
||||||
print("Four score and seven years ago...")
|
print("Four score and seven years ago...")
|
||||||
|
def test_pass_no_output():
|
||||||
|
pass
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
result = testdir.runpytest()
|
result = testdir.runpytest()
|
||||||
assert "Four score and seven years ago..." not in result.stdout.str()
|
s = result.stdout.str()
|
||||||
|
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("-rP")
|
||||||
result.stdout.fnmatch_lines(["Four score and seven years ago..."])
|
result.stdout.fnmatch_lines(
|
||||||
|
["*test_pass_has_output*", "Four score and seven years ago..."]
|
||||||
|
)
|
||||||
|
assert "test_pass_no_output" not in result.stdout.str()
|
||||||
|
|
||||||
|
|
||||||
def test_color_yes(testdir):
|
def test_color_yes(testdir):
|
||||||
|
|
Loading…
Reference in New Issue