aboutsummaryrefslogtreecommitdiffstats
path: root/tests/conftest.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-01-20 13:38:36 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-01-20 13:38:36 -0600
commit1de55b76b12d7ade3e19f2c8e094695201d1523f (patch)
tree2e4537ec44634106da56a0bf38beab667e480dc4 /tests/conftest.py
parent5ab6a208c46f1de6e261646a0ad34482ea755922 (diff)
parentcd10571261ad24dcd0dc63c9703289faccd841a8 (diff)
downloadcryptography-1de55b76b12d7ade3e19f2c8e094695201d1523f.tar.gz
cryptography-1de55b76b12d7ade3e19f2c8e094695201d1523f.tar.bz2
cryptography-1de55b76b12d7ade3e19f2c8e094695201d1523f.zip
Merge branch 'master' into commoncrypto-cipher-backend
* master: expand tox backend example On OS X at build time compile the CC bindings fix docs update docs for name attribute revert fixture decorator for now, switch to append. no more globals docs for explicit backend selection and document name attribute of backend modify backend selection to allow multiple backends via comma delimiter better name for the variable don't mutate _ALL_BACKENDS pass posargs via tox so --backend can be used for tox envs support --backend as a pytest flag to limit to one backend for testing
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."
+ )