aboutsummaryrefslogtreecommitdiffstats
path: root/tests/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utils.py')
-rw-r--r--tests/utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/utils.py b/tests/utils.py
index 3e35970e..bdbf996f 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -14,11 +14,13 @@
from __future__ import absolute_import, division, print_function
import collections
+from contextlib import contextmanager
import pytest
import six
+from cryptography.exceptions import UnsupportedAlgorithm
import cryptography_vectors
@@ -67,6 +69,14 @@ def check_backend_support(item):
"backend")
+@contextmanager
+def raises_unsupported_algorithm(reason):
+ with pytest.raises(UnsupportedAlgorithm) as exc_info:
+ yield exc_info
+
+ assert exc_info.value._reason is reason
+
+
def load_vectors_from_file(filename, loader):
with cryptography_vectors.open_vector_file(filename) as vector_file:
return loader(vector_file)