tests: Handle report.longrepr being a tuple.

For some unknown reason, report.longrepr.addsection might not exist, which
caused failures on OS X and Windows. If that happens, we just don't add a
section at all.
This commit is contained in:
Florian Bruhin 2015-12-16 22:47:33 +01:00
parent e6284ed5d4
commit a157f822d6

View File

@ -86,6 +86,11 @@ def pytest_runtest_makereport(item, call):
quteproc_log = getattr(item, '_quteproc_log', None)
httpbin_log = getattr(item, '_httpbin_log', None)
if not hasattr(report.longrepr, 'addsection'):
# In some conditions (on OS X and Windows it seems), report.longrepr is
# actually a tuple. This is handled similarily in pytest-qt too.
return
if quteproc_log is not None:
report.longrepr.addsection("qutebrowser output",
'\n'.join(quteproc_log))