aboutsummaryrefslogtreecommitdiffstats
path: root/tests/utils.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-03-27 11:04:21 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2014-03-27 11:04:21 -0700
commit3d5d6471b10e5f46eb8b40a9a41eb16e657d25b8 (patch)
tree8285f420269fd636e63c9152143750922e48e869 /tests/utils.py
parent844c14a15884fb60871640576e30a61e6c4c2db1 (diff)
parent85a791f0fa061ec644f5bfca41ee6038eeef38eb (diff)
downloadcryptography-3d5d6471b10e5f46eb8b40a9a41eb16e657d25b8.tar.gz
cryptography-3d5d6471b10e5f46eb8b40a9a41eb16e657d25b8.tar.bz2
cryptography-3d5d6471b10e5f46eb8b40a9a41eb16e657d25b8.zip
Merge pull request #849 from public/changeup-exceptions-2-electric-boogaloo
Use a single tagged exception instead of a hierarchy
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)