From 2dd21fec484c85647d73145bd9957fd5326495c3 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sat, 4 Jan 2014 18:13:40 -0600 Subject: remove unneeded mark now that is_available is there --- pytest.ini | 1 - tests/conftest.py | 5 +---- tests/test_utils.py | 32 +------------------------------- tests/utils.py | 6 ------ 4 files changed, 2 insertions(+), 42 deletions(-) diff --git a/pytest.ini b/pytest.ini index 4bb9b0f9..36d4edc4 100644 --- a/pytest.ini +++ b/pytest.ini @@ -5,4 +5,3 @@ markers = cipher: this test requires a backend providing CipherBackend hash: this test requires a backend providing HashBackend supported: parametrized test requiring only_if and skip_message - binding_available: verifies a given binding is available diff --git a/tests/conftest.py b/tests/conftest.py index 3ba2425d..0ddc3338 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,9 +4,7 @@ from cryptography.hazmat.backends.interfaces import ( HMACBackend, CipherBackend, HashBackend ) -from .utils import ( - check_for_iface, check_backend_support, check_binding_available -) +from .utils import check_for_iface, check_backend_support def pytest_generate_tests(metafunc): @@ -22,4 +20,3 @@ def pytest_runtest_setup(item): check_for_iface("cipher", CipherBackend, item) check_for_iface("hash", HashBackend, item) check_backend_support(item) - check_binding_available(item) diff --git a/tests/test_utils.py b/tests/test_utils.py index 6f938f58..e3e53d63 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -14,18 +14,14 @@ import os import textwrap -import cffi - import pretend import pytest -from cryptography.hazmat.bindings.utils import binding_available - from .utils import ( load_nist_vectors, load_vectors_from_file, load_cryptrec_vectors, load_openssl_vectors, load_hash_vectors, check_for_iface, - check_backend_support, check_binding_available + check_backend_support ) @@ -33,16 +29,6 @@ class FakeInterface(object): pass -class FakeBinding(object): - @classmethod - def _ensure_ffi_initialized(cls): - raise cffi.VerificationError - - @classmethod - def is_available(cls): - return binding_available(cls._ensure_ffi_initialized) - - def test_check_for_iface(): item = pretend.stub(keywords=["fake_name"], funcargs={"backend": True}) with pytest.raises(pytest.skip.Exception) as exc_info: @@ -86,22 +72,6 @@ def test_check_backend_support_no_backend(): check_backend_support(item) -def test_check_binding_available(): - from cryptography.hazmat.bindings.openssl.binding import Binding - kwargs = pretend.stub(kwargs={"binding": Binding}) - item = pretend.stub(keywords={"binding_available": kwargs}) - assert check_binding_available(item) is None - - -def test_check_binding_unavailable(): - kwargs = pretend.stub(kwargs={"binding": FakeBinding}) - item = pretend.stub(keywords={"binding_available": kwargs}) - with pytest.raises(pytest.skip.Exception) as exc_info: - check_binding_available(item) - assert exc_info.value.args[0] == ("" - " is not available") - - def test_load_nist_vectors(): vector_data = textwrap.dedent(""" # CAVS 11.1 diff --git a/tests/utils.py b/tests/utils.py index 6d47a398..693a0c8f 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -36,12 +36,6 @@ def check_backend_support(item): "backend") -def check_binding_available(item): - ba = item.keywords.get("binding_available") - if ba and not ba.kwargs["binding"].is_available(): - pytest.skip("{0} is not available".format(ba.kwargs["binding"])) - - def load_vectors_from_file(filename, loader): base = os.path.join( os.path.dirname(__file__), "hazmat", "primitives", "vectors", -- cgit v1.2.3