Skip to content

Commit

Permalink
Tidy up buffered output a little
Browse files Browse the repository at this point in the history
  • Loading branch information
cjwatson committed Oct 17, 2019
1 parent 87fdbdb commit 855652f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/zope/testrunner/formatter.py
Expand Up @@ -364,15 +364,17 @@ def print_traceback(self, msg, exc_info):
def print_std_streams(self, stdout, stderr):
"""Emit contents of buffered standard streams."""
if stdout:
sys.stdout.write("\nStdout:\n")
sys.stdout.write("Stdout:\n")
sys.stdout.write(stdout)
if not stdout.endswith("\n"):
sys.stdout.write("\n")
sys.stdout.write("\n")
if stderr:
sys.stderr.write("\nStderr:\n")
sys.stderr.write("Stderr:\n")
sys.stderr.write(stderr)
if not stderr.endswith("\n"):
sys.stderr.write("\n")
sys.stderr.write("\n")

def format_traceback(self, exc_info):
"""Format the traceback."""
Expand Down
4 changes: 0 additions & 4 deletions src/zope/testrunner/tests/testrunner-errors.rst
Expand Up @@ -387,7 +387,6 @@ for failing and erroring tests.
raise Exception("boom")
Exception: boom
<BLANKLINE>
<BLANKLINE>
Stderr:
stderr output on error
<BLANKLINE>
Expand All @@ -398,7 +397,6 @@ for failing and erroring tests.
self.assertTrue(False)
AssertionError: False is not true
<BLANKLINE>
<BLANKLINE>
Stderr:
stderr output on failure
<BLANKLINE>
Expand All @@ -409,7 +407,6 @@ for failing and erroring tests.
raise Exception("boom")
Exception: boom
<BLANKLINE>
<BLANKLINE>
Stdout:
stdout output on error
<BLANKLINE>
Expand All @@ -420,7 +417,6 @@ for failing and erroring tests.
self.assertTrue(False)
AssertionError: False is not true
<BLANKLINE>
<BLANKLINE>
Stdout:
stdout output on failure
Ran 6 tests with 2 failures, 2 errors and 0 skipped in N.NNN seconds.
Expand Down

0 comments on commit 855652f

Please sign in to comment.