This commit is contained in:
Daniel Hahler 2019-04-07 20:04:31 +02:00
parent d8d835c1f5
commit 2662c400ba
1 changed files with 33 additions and 41 deletions

View File

@ -880,41 +880,35 @@ class TerminalReporter(object):
return
def show_simple(stat, lines):
failed = self.stats.get(stat)
if failed:
config = self.config
failed = self.stats.get(stat, [])
for rep in failed:
verbose_word = _get_report_str(config, rep)
pos = _get_pos(config, rep)
verbose_word = _get_report_str(self.config, rep)
pos = _get_pos(self.config, rep)
lines.append("%s %s" % (verbose_word, pos))
def show_xfailed(lines):
xfailed = self.stats.get("xfailed")
if xfailed:
config = self.config
xfailed = self.stats.get("xfailed", [])
for rep in xfailed:
verbose_word = _get_report_str(config, rep)
pos = _get_pos(config, rep)
verbose_word = _get_report_str(self.config, rep)
pos = _get_pos(self.config, rep)
lines.append("%s %s" % (verbose_word, pos))
reason = rep.wasxfail
if reason:
lines.append(" " + str(reason))
def show_xpassed(lines):
xpassed = self.stats.get("xpassed")
if xpassed:
config = self.config
xpassed = self.stats.get("xpassed", [])
for rep in xpassed:
verbose_word = _get_report_str(config, rep)
pos = _get_pos(config, rep)
verbose_word = _get_report_str(self.config, rep)
pos = _get_pos(self.config, rep)
reason = rep.wasxfail
lines.append("%s %s %s" % (verbose_word, pos, reason))
def show_skipped(lines):
skipped = self.stats.get("skipped", [])
if skipped:
fskips = _folded_skips(skipped)
if fskips:
fskips = _folded_skips(skipped) if skipped else []
if not fskips:
return
verbose_word = _get_report_str(self.config, report=skipped[0])
for num, fspath, lineno, reason in fskips:
if reason.startswith("Skipped: "):
@ -925,9 +919,7 @@ class TerminalReporter(object):
% (verbose_word, num, fspath, lineno + 1, reason)
)
else:
lines.append(
"%s [%d] %s: %s" % (verbose_word, num, fspath, reason)
)
lines.append("%s [%d] %s: %s" % (verbose_word, num, fspath, reason))
def _get_report_str(config, report):
_category, _short, verbose = config.hook.pytest_report_teststatus(