aboutsummaryrefslogtreecommitdiffstats
path: root/tests/conftest.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-10-25 21:39:35 -0700
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-10-25 21:39:35 -0700
commit8d10a1366ac4059ef07f3babb263b1c5397fa8e5 (patch)
tree096c95f01303545b154874df29862a1cd47a519e /tests/conftest.py
parent4d05537fa5e6c3a3f38b9027deeaf8e799a3a415 (diff)
downloadcryptography-8d10a1366ac4059ef07f3babb263b1c5397fa8e5.tar.gz
cryptography-8d10a1366ac4059ef07f3babb263b1c5397fa8e5.tar.bz2
cryptography-8d10a1366ac4059ef07f3babb263b1c5397fa8e5.zip
fix coverage for backend parametrization
Any test that takes a backend is required to provide the requires_backend_interface decorator.
Diffstat (limited to 'tests/conftest.py')
-rw-r--r--tests/conftest.py15
1 files changed, 5 insertions, 10 deletions
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