From 9e9cedf3e0d70fc38dc182092b3e20ac078968e8 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 7 Jan 2016 19:39:46 +0100 Subject: [PATCH] tests: Shorten (not suppress) quteproc log w/o -v. The output was almost always useless without -v because the debug log wasn't shown at all, only error/info. Now we display a maximum of 50 lines (regardless of what level) without -v. --- tests/integration/quteprocess.py | 7 +------ tests/integration/testprocess.py | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/tests/integration/quteprocess.py b/tests/integration/quteprocess.py index b981fca7a..dca1680f4 100644 --- a/tests/integration/quteprocess.py +++ b/tests/integration/quteprocess.py @@ -169,12 +169,7 @@ class QuteProc(testprocess.Process): else: raise - # WORKAROUND for https://bitbucket.org/logilab/pylint/issues/717/ - # we should switch to generated-members after that - # pylint: disable=no-member - if (log_line.loglevel in ['INFO', 'WARNING', 'ERROR'] or - pytest.config.getoption('--verbose')): - self._log(line) + self._log(line) start_okay_message_load = ( "load status for threshold and not pytest.config.getoption('--verbose'): + msg = '[{} lines suppressed, use -v to show]'.format( + len(data) - threshold) + data = [msg] + data[-threshold:] + return '\n'.join(data) + + @pytest.hookimpl(hookwrapper=True) def pytest_runtest_makereport(item, call): """Add qutebrowser/httpbin sections to captured output if a test failed.""" @@ -93,10 +105,9 @@ def pytest_runtest_makereport(item, call): if quteproc_log is not None: report.longrepr.addsection("qutebrowser output", - '\n'.join(quteproc_log)) + _render_log(quteproc_log)) if httpbin_log is not None: - report.longrepr.addsection("httpbin output", - '\n'.join(httpbin_log)) + report.longrepr.addsection("httpbin output", _render_log(httpbin_log)) class Process(QObject):