Paul Kehrer | 7e4bc6d | 2013-12-24 22:23:53 -0600 | [diff] [blame] | 1 | import pytest |
| 2 | |
| 3 | from cryptography.hazmat.backends.interfaces import ( |
| 4 | HMACBackend, CipherBackend, HashBackend |
| 5 | ) |
| 6 | |
Paul Kehrer | 60fc8da | 2013-12-26 20:19:34 -0600 | [diff] [blame^] | 7 | from .utils import check_for_iface, check_backend_support |
Paul Kehrer | 7e4bc6d | 2013-12-24 22:23:53 -0600 | [diff] [blame] | 8 | |
| 9 | |
Alex Gaynor | 814efab | 2013-10-03 09:24:58 -0700 | [diff] [blame] | 10 | def pytest_generate_tests(metafunc): |
Alex Gaynor | f8796b1 | 2013-12-13 20:28:55 -0800 | [diff] [blame] | 11 | from cryptography.hazmat.backends import _ALL_BACKENDS |
Alex Gaynor | 814efab | 2013-10-03 09:24:58 -0700 | [diff] [blame] | 12 | |
Paul Kehrer | db37d0e | 2013-10-22 20:13:06 -0500 | [diff] [blame] | 13 | if "backend" in metafunc.fixturenames: |
| 14 | metafunc.parametrize("backend", _ALL_BACKENDS) |
Paul Kehrer | 7e4bc6d | 2013-12-24 22:23:53 -0600 | [diff] [blame] | 15 | |
| 16 | |
| 17 | @pytest.mark.trylast |
| 18 | def pytest_runtest_setup(item): |
Alex Gaynor | 2b3f942 | 2013-12-24 21:55:24 -0800 | [diff] [blame] | 19 | check_for_iface("hmac", HMACBackend, item) |
| 20 | check_for_iface("cipher", CipherBackend, item) |
| 21 | check_for_iface("hash", HashBackend, item) |
Paul Kehrer | 60fc8da | 2013-12-26 20:19:34 -0600 | [diff] [blame^] | 22 | check_backend_support(item) |