Skip to content

Commit

Permalink
Fix test runner double printing in non-verbose mode (#1158)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Tritt <[email protected]>
  • Loading branch information
rly and ajtritt authored Jan 27, 2020
1 parent d063372 commit a41eaee
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tests/coloredtestrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,9 @@ def addSuccess(self, test):
super(ColoredTestResult, self).addSuccess(test)
output = self.complete_output()
self.result.append((0, test, output, ''))
sys.stdout.write('.')
sys.stdout.flush()
if self.verbosity > 1:
sys.stdout.write('.')
sys.stdout.flush()

if not hasattr(self, 'successes'):
self.successes = [test]
Expand All @@ -273,17 +274,19 @@ def addError(self, test, err):
output = self.complete_output()
_, _exc_str = self.errors[-1]
self.result.append((2, test, output, _exc_str))
sys.stdout.write('E')
sys.stdout.flush()
if self.verbosity > 1:
sys.stdout.write('E')
sys.stdout.flush()

def addFailure(self, test, err):
self.failure_count += 1
super(ColoredTestResult, self).addFailure(test, err)
output = self.complete_output()
_, _exc_str = self.failures[-1]
self.result.append((1, test, output, _exc_str))
sys.stdout.write('F')
sys.stdout.flush()
if self.verbosity > 1:
sys.stdout.write('F')
sys.stdout.flush()

def addSubTest(self, test, subtest, err):
if err is not None:
Expand All @@ -296,8 +299,9 @@ def addSkip(self, test, reason):
self.skip_count += 1
super(ColoredTestResult, self).addSkip(test, reason)
self.complete_output()
sys.stdout.write('s')
sys.stdout.flush()
if self.verbosity > 1:
sys.stdout.write('s')
sys.stdout.flush()

def get_all_cases_run(self):
'''Return a list of each test case which failed or succeeded
Expand Down

0 comments on commit a41eaee

Please sign in to comment.