Commit 445c37b0 authored by Mathieu Giraud's avatar Mathieu Giraud

src/should.py: refactor, extract and streamline .debug() from TestSuite.test()

(using FAIL_STATUS)
parent 76a0deb2
......@@ -858,6 +858,7 @@ class TestSuite():
self.test_lines = open(self.source).readlines() if self.source else self.stdout
self.tests_on_lines(self.tests, self.test_lines, verbose, colorize)
self.debug(self.status, cmd, self.test_lines, verbose, colorize)
self.elapsed_time = time.time() - start_time
......@@ -884,11 +885,12 @@ class TestSuite():
if verbose > 0 or test.status in WARN_STATUS:
print(test.str(colorize))
if self.status is False and verbose <= 0:
def debug(self, status, cmd, test_lines, verbose, colorize):
if status in FAIL_STATUS and verbose <= 0:
print(color(ANSI.MAGENTA, cmd, colorize))
self.print_stderr(colorize)
if self.status is False or verbose > 1:
if status in FAIL_STATUS or verbose > 1:
print(LINE)
if len(test_lines) <= MAX_DUMP_LINES:
print(''.join(test_lines), end='')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment