parent
06b1b69fb7
commit
e59471766a
|
@ -326,7 +326,7 @@ def testdir(request, tmpdir_factory):
|
|||
return Testdir(request, tmpdir_factory)
|
||||
|
||||
|
||||
rex_outcome = re.compile("(\d+) (\w+)")
|
||||
rex_outcome = re.compile("(\d+) ([\w-]+)")
|
||||
class RunResult:
|
||||
"""The result of running a command.
|
||||
|
||||
|
|
|
@ -438,7 +438,7 @@ class TerminalReporter:
|
|||
warnings = self.stats.get("warnings")
|
||||
if not warnings:
|
||||
return
|
||||
self.write_sep("=", "warning summary")
|
||||
self.write_sep("=", "pytest-warning summary")
|
||||
for w in warnings:
|
||||
self._tw.line("W%s %s %s" % (w.code,
|
||||
w.fslocation, w.message))
|
||||
|
@ -527,6 +527,7 @@ def flatten(l):
|
|||
def build_summary_stats_line(stats):
|
||||
keys = ("failed passed skipped deselected "
|
||||
"xfailed xpassed warnings error").split()
|
||||
key_translation = {'warnings': 'pytest-warnings'}
|
||||
unknown_key_seen = False
|
||||
for key in stats.keys():
|
||||
if key not in keys:
|
||||
|
@ -537,7 +538,8 @@ def build_summary_stats_line(stats):
|
|||
for key in keys:
|
||||
val = stats.get(key, None)
|
||||
if val:
|
||||
parts.append("%d %s" % (len(val), key))
|
||||
key_name = key_translation.get(key, key)
|
||||
parts.append("%d %s" % (len(val), key_name))
|
||||
line = ", ".join(parts)
|
||||
|
||||
if 'failed' in stats or 'error' in stats:
|
||||
|
|
|
@ -429,12 +429,12 @@ class TestWarning:
|
|||
pass
|
||||
""")
|
||||
result = testdir.runpytest()
|
||||
assert result.parseoutcomes()["warnings"] > 0
|
||||
assert result.parseoutcomes()["pytest-warnings"] > 0
|
||||
assert "hello" not in result.stdout.str()
|
||||
|
||||
result = testdir.runpytest("-rw")
|
||||
result.stdout.fnmatch_lines("""
|
||||
===*warning summary*===
|
||||
===*pytest-warning summary*===
|
||||
*WT1*test_warn_on_test_item*:5*hello*
|
||||
""")
|
||||
|
||||
|
|
|
@ -756,8 +756,9 @@ def test_terminal_summary(testdir):
|
|||
("yellow", "1 weird", {"weird": (1,)}),
|
||||
("yellow", "1 passed, 1 weird", {"weird": (1,), "passed": (1,)}),
|
||||
|
||||
("yellow", "1 warnings", {"warnings": (1,)}),
|
||||
("yellow", "1 passed, 1 warnings", {"warnings": (1,), "passed": (1,)}),
|
||||
("yellow", "1 pytest-warnings", {"warnings": (1,)}),
|
||||
("yellow", "1 passed, 1 pytest-warnings", {"warnings": (1,),
|
||||
"passed": (1,)}),
|
||||
|
||||
("green", "5 passed", {"passed": (1,2,3,4,5)}),
|
||||
|
||||
|
|
Loading…
Reference in New Issue