Skip to content

Commit

Permalink
Bump the validator version used for suite sanity checks.
Browse files Browse the repository at this point in the history
And fix skipping regex format validation and the case where
dynamicRef blows up.

(The latter hopefully being temporary, but just so the PR passes)
  • Loading branch information
Julian committed Dec 6, 2022
1 parent c264401 commit b538fe7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion bin/jsonschema_suite
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,18 @@ class SanityTests(unittest.TestCase):

Validator = VALIDATORS.get(version.name)
if Validator is not None:
# Valid (optional test) schemas contain regexes which
# aren't valid Python regexes, so skip checking it
Validator.FORMAT_CHECKER.checkers.pop("regex", None)

test_files = collect(version)
for case in cases(test_files):
with self.subTest(case=case):
try:
Validator.check_schema(case["schema"])
Validator.check_schema(
case["schema"],
format_checker=Validator.FORMAT_CHECKER,
)
except jsonschema.SchemaError:
self.fail(
"Found an invalid schema. "
Expand Down Expand Up @@ -262,6 +269,9 @@ class SanityTests(unittest.TestCase):
with self.subTest(path=path):
try:
validator.validate(cases)
except jsonschema.exceptions.RefResolutionError as error:
# python-jsonschema/jsonschema#884
pass
except jsonschema.ValidationError as error:
self.fail(str(error))

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ skipsdist = True

[testenv:sanity]
# used just for validating the structure of the test case files themselves
deps = jsonschema==4.6.1
deps = jsonschema==4.17.3
commands = {envpython} bin/jsonschema_suite check

0 comments on commit b538fe7

Please sign in to comment.