summaryrefslogtreecommitdiff
path: root/tests/unittests/helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unittests/helpers.py')
-rw-r--r--tests/unittests/helpers.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unittests/helpers.py b/tests/unittests/helpers.py
index 32503fb8..0656da33 100644
--- a/tests/unittests/helpers.py
+++ b/tests/unittests/helpers.py
@@ -491,9 +491,23 @@ try:
import jsonschema
assert jsonschema # avoid pyflakes error F401: import unused
+ _jsonschema_version = tuple(
+ int(part) for part in jsonschema.__version__.split(".") # type: ignore
+ )
_missing_jsonschema_dep = False
except ImportError:
_missing_jsonschema_dep = True
+ _jsonschema_version = (0, 0, 0)
+
+
+def skipUnlessJsonSchemaVersionGreaterThan(version=(0, 0, 0)):
+ return skipIf(
+ _jsonschema_version <= version,
+ reason=(
+ f"python3-jsonschema {_jsonschema_version} not greater than"
+ f" {version}"
+ ),
+ )
def skipUnlessJsonSchema():