summaryrefslogtreecommitdiff
path: root/tests/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utils.py')
-rw-r--r--tests/utils.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/utils.py b/tests/utils.py
index 4b988e6..6847aba 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -2,6 +2,10 @@ import os
from calendar import timegm
from datetime import datetime
+import pytest
+
+from jwt.algorithms import has_crypto
+
def utc_timestamp():
return timegm(datetime.utcnow().utctimetuple())
@@ -11,3 +15,18 @@ def key_path(key_name):
return os.path.join(
os.path.dirname(os.path.realpath(__file__)), "keys", key_name
)
+
+
+def no_crypto_required(class_or_func):
+ decorator = pytest.mark.skipif(
+ has_crypto,
+ reason="Requires cryptography library not installed",
+ )
+ return decorator(class_or_func)
+
+
+def crypto_required(class_or_func):
+ decorator = pytest.mark.skipif(
+ not has_crypto, reason="Requires cryptography library installed"
+ )
+ return decorator(class_or_func)