From a157f822d6dad1c1eba7ee2815fd3d7b4ed9ddc4 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 16 Dec 2015 22:47:33 +0100 Subject: [PATCH] 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. --- tests/integration/testprocess.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/integration/testprocess.py b/tests/integration/testprocess.py index e568ae40e..0ac14043e 100644 --- a/tests/integration/testprocess.py +++ b/tests/integration/testprocess.py @@ -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))