blob: d8ab5819d9957194e1ffa665c07f3410f5576a7f [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 Kehrer5a8fdf82013-12-26 20:13:45 -06007from .utils import check_for_iface, supported_by_backend_skip
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 Kehrer5a8fdf82013-12-26 20:13:45 -060022 supported_by_backend_skip(item)