From 8d10a1366ac4059ef07f3babb263b1c5397fa8e5 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sat, 25 Oct 2014 21:39:35 -0700 Subject: fix coverage for backend parametrization Any test that takes a backend is required to provide the requires_backend_interface decorator. --- tests/conftest.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/conftest.py b/tests/conftest.py index 9dc37d38..27cf13b0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -27,17 +27,12 @@ def pytest_generate_tests(metafunc): if "backend" in metafunc.fixturenames: filtered_backends = [] for backend in selected_backends: - try: - required = metafunc.function.requires_backend_interface - except AttributeError: - # function does not have requires_backend_interface decorator + required = metafunc.function.requires_backend_interface + required_interfaces = tuple( + mark.kwargs["interface"] for mark in required + ) + if isinstance(backend, required_interfaces): filtered_backends.append(backend) - else: - required_interfaces = tuple( - mark.kwargs["interface"] for mark in required - ) - if isinstance(backend, required_interfaces): - filtered_backends.append(backend) # If you pass an empty list to parametrize Bad Things(tm) happen # as of pytest 2.6.4 when the test also has a parametrize decorator -- cgit v1.2.3