aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2014-09-01 08:44:44 +0200
committerArmin Rigo <arigo@tunes.org>2014-09-01 08:44:44 +0200
commit8799d15a568328a283dbb09001686f83b60f5d86 (patch)
tree48cab84c3b4581ccf33a51ec6bb72f995cc72e2a /_pytest
parentrename argument for consistency with RFile (diff)
downloadpypy-8799d15a568328a283dbb09001686f83b60f5d86.tar.gz
pypy-8799d15a568328a283dbb09001686f83b60f5d86.tar.bz2
pypy-8799d15a568328a283dbb09001686f83b60f5d86.zip
Attempt to get the stdout/stderr as well in the written resultlogs.
Diffstat (limited to '_pytest')
-rw-r--r--_pytest/resultlog.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/_pytest/resultlog.py b/_pytest/resultlog.py
index 0c100552f0..c086783c12 100644
--- a/_pytest/resultlog.py
+++ b/_pytest/resultlog.py
@@ -53,16 +53,23 @@ class ResultLog(object):
self.config = config
self.logfile = logfile # preferably line buffered
- def write_log_entry(self, testpath, lettercode, longrepr):
+ def write_log_entry(self, testpath, lettercode, longrepr, sections=None):
py.builtin.print_("%s %s" % (lettercode, testpath), file=self.logfile)
for line in longrepr.splitlines():
py.builtin.print_(" %s" % line, file=self.logfile)
+ if sections is not None:
+ for title, content in sections:
+ py.builtin.print_(" ---------- %s ----------" % (title,),
+ file=self.logfile)
+ for line in content.splitlines():
+ py.builtin.print_(" %s" % line, file=self.logfile)
def log_outcome(self, report, lettercode, longrepr):
testpath = getattr(report, 'nodeid', None)
if testpath is None:
testpath = report.fspath
- self.write_log_entry(testpath, lettercode, longrepr)
+ self.write_log_entry(testpath, lettercode, longrepr,
+ getattr(report, 'sections', None))
def pytest_runtest_logreport(self, report):
if report.when != "call" and report.passed: