Skip to content

Commit

Permalink
Merge pull request #99 from cjwatson/fix-layer-failure-counting
Browse files Browse the repository at this point in the history
Fix failure counting across layers
  • Loading branch information
cjwatson authored Oct 18, 2019
2 parents 15667b8 + 96ff9bf commit bb1f439
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
- Add optional buffering of standard output and standard error during tests,
requested via the ``--buffer`` option or enabled by default for subunit.

- Fix incorrect failure counts in per-layer summary output, broken in 4.0.1.


5.0 (2019-03-19)
================
Expand Down
4 changes: 3 additions & 1 deletion src/zope/testrunner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,14 +400,16 @@ def run_tests(options, tests, name, failures, errors, skipped, import_errors):
t = time.time() - t
output.stop_tests()
failures.extend(result.failures)
n_failures = len(result.failures)
if hasattr(result, 'unexpectedSuccesses'):
# Python versions prior to 2.7 do not have the concept of
# unexpectedSuccesses.
failures.extend(result.unexpectedSuccesses)
n_failures += len(result.unexpectedSuccesses)
skipped.extend(result.skipped)
errors.extend(result.errors)
output.summary(n_tests=result.testsRun,
n_failures=len(failures),
n_failures=n_failures,
n_errors=len(result.errors) + len(import_errors),
n_seconds=t,
n_skipped=len(result.skipped))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ When we don't pass the flag, we see two layers are tested
testrunner-ex-37/stop_on_error.py", Line NNN, in test
self.assertTrue(False)
AssertionError: False is not true
Ran 1 tests with 2 failures, 0 errors and 0 skipped in N.NNN seconds.
Ran 1 tests with 1 failures, 0 errors and 0 skipped in N.NNN seconds.
Tearing down left over layers:
Tear down layers.LayerB in N.NNN seconds.
Total: 2 tests, 2 failures, 0 errors and 0 skipped in N.NNN seconds.
Expand Down

0 comments on commit bb1f439

Please sign in to comment.