bdd: Don't shorten log if an exception happened

This commit is contained in:
Florian Bruhin 2016-04-20 07:28:34 +02:00
parent 1579f27564
commit 266bc6e8d8

View File

@ -76,7 +76,11 @@ class Line:
def _render_log(data, threshold=100):
"""Shorten the given log without -v and convert to a string."""
# pylint: disable=no-member
if len(data) > threshold and not pytest.config.getoption('--verbose'):
is_exception = any('Traceback (most recent call last):' in line
for line in data)
if (len(data) > threshold and
not pytest.config.getoption('--verbose') and
not is_exception):
msg = '[{} lines suppressed, use -v to show]'.format(
len(data) - threshold)
data = [msg] + data[-threshold:]