From fd8286d4eb405c567cbd752312f65917edee5c07 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 6 Jun 2016 23:37:26 +0200 Subject: [PATCH] Fix BDD runtest_makereport hook on non-BDD tests --- tests/end2end/features/conftest.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/end2end/features/conftest.py b/tests/end2end/features/conftest.py index d61ec2cd8..1564d48be 100644 --- a/tests/end2end/features/conftest.py +++ b/tests/end2end/features/conftest.py @@ -46,9 +46,13 @@ def pytest_runtest_makereport(item, call): if report.passed: return - if not hasattr(report.longrepr, 'addsection'): + if (not hasattr(report.longrepr, 'addsection') or + not hasattr(report, 'scenario')): # In some conditions (on OS X and Windows it seems), report.longrepr is # actually a tuple. This is handled similarily in pytest-qt too. + # + # Since this hook is invoked for any test, we also need to skip it for + # non-BDD ones. return if sys.stdout.isatty() and item.config.getoption('--color') != 'no':