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