blob: 0ddc333882deedf3aa9b509e227c247174b6aee0 [file] [log] [blame]
Paul Kehrer7e4bc6d2013-12-24 22:23:53 -06001import pytest
2
3from cryptography.hazmat.backends.interfaces import (
4 HMACBackend, CipherBackend, HashBackend
5)
6
Paul Kehrer60fc8da2013-12-26 20:19:34 -06007from .utils import check_for_iface, check_backend_support
Paul Kehrer7e4bc6d2013-12-24 22:23:53 -06008
9
Alex Gaynor814efab2013-10-03 09:24:58 -070010def pytest_generate_tests(metafunc):
Alex Gaynorf8796b12013-12-13 20:28:55 -080011 from cryptography.hazmat.backends import _ALL_BACKENDS
Alex Gaynor814efab2013-10-03 09:24:58 -070012
Paul Kehrerdb37d0e2013-10-22 20:13:06 -050013 if "backend" in metafunc.fixturenames:
14 metafunc.parametrize("backend", _ALL_BACKENDS)
Paul Kehrer7e4bc6d2013-12-24 22:23:53 -060015
16
17@pytest.mark.trylast
18def pytest_runtest_setup(item):
Alex Gaynor2b3f9422013-12-24 21:55:24 -080019 check_for_iface("hmac", HMACBackend, item)
20 check_for_iface("cipher", CipherBackend, item)
21 check_for_iface("hash", HashBackend, item)
Paul Kehrer60fc8da2013-12-26 20:19:34 -060022 check_backend_support(item)