Unittest - Fix newlines should be interpreted in printed output

This commit is contained in:
Renato Alves 2014-07-24 13:07:39 +01:00
parent f5b778b800
commit f39617a753

View file

@ -66,6 +66,9 @@ class TAPTestResult(unittest.result.TestResult):
def _do_stream(data, stream):
"""Helper function for _mergeStdout"""
for line in data.splitlines(True):
# newlines should be taken literally and be comments in TAP
line = line.replace("\\n", "\n# ")
# Add a comment sign before each line
if line.startswith("#"):
stream.write(line)