@@ -17,13 +17,9 @@ if getattr(unittest, "skipIf", None) is None:
17
17
unittest .skipIf = lambda cond , msg : lambda fn : fn
18
18
19
19
try :
20
- import jsonschema
20
+ import jsonschema . validators
21
21
except ImportError :
22
22
jsonschema = None
23
- else :
24
- validators = getattr (
25
- jsonschema .validators , "validators" , jsonschema .validators
26
- )
27
23
28
24
29
25
ROOT_DIR = os .path .abspath (
@@ -120,7 +116,7 @@ class SanityTests(unittest.TestCase):
120
116
@unittest .skipIf (jsonschema is None , "Validation library not present!" )
121
117
def test_all_schemas_are_valid (self ):
122
118
for schema in os .listdir (SUITE_ROOT_DIR ):
123
- schema_validator = validators .get (schema )
119
+ schema_validator = jsonschema . validators . validators .get (schema )
124
120
if schema_validator is not None :
125
121
test_files = collect (os .path .join (SUITE_ROOT_DIR , schema ))
126
122
for case in cases (test_files ):
@@ -134,7 +130,8 @@ class SanityTests(unittest.TestCase):
134
130
135
131
@unittest .skipIf (jsonschema is None , "Validation library not present!" )
136
132
def test_suites_are_valid (self ):
137
- validator = jsonschema .Draft4Validator (TESTSUITE_SCHEMA )
133
+ Validator = jsonschema .validators .validator_for (TESTSUITE_SCHEMA )
134
+ validator = Validator (TESTSUITE_SCHEMA )
138
135
for tests in files (self .test_files ):
139
136
try :
140
137
validator .validate (tests )
0 commit comments