aboutsummaryrefslogtreecommitdiffstats
path: root/tests/conftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/conftest.py')
-rw-r--r--tests/conftest.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 1d9f96ed..a9acb54a 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -5,12 +5,15 @@ from cryptography.hazmat.backends.interfaces import (
HMACBackend, CipherBackend, HashBackend
)
-from .utils import check_for_iface, check_backend_support
+from .utils import check_for_iface, check_backend_support, select_backends
-@pytest.fixture(params=_ALL_BACKENDS)
-def backend(request):
- return request.param
+def pytest_generate_tests(metafunc):
+ names = metafunc.config.getoption("--backend")
+ selected_backends = select_backends(names, _ALL_BACKENDS)
+
+ if "backend" in metafunc.fixturenames:
+ metafunc.parametrize("backend", selected_backends)
@pytest.mark.trylast
@@ -19,3 +22,10 @@ def pytest_runtest_setup(item):
check_for_iface("cipher", CipherBackend, item)
check_for_iface("hash", HashBackend, item)
check_backend_support(item)
+
+
+def pytest_addoption(parser):
+ parser.addoption(
+ "--backend", action="store", metavar="NAME",
+ help="Only run tests matching the backend NAME."
+ )