@@ -35,8 +35,10 @@ OUTPUT_ROOT_DIR = ROOT_DIR / "output-tests"
35
35
REMOTES_DIR = ROOT_DIR / "remotes"
36
36
REMOTES_BASE_URL = "http://localhost:1234/"
37
37
38
- TESTSUITE_SCHEMA = json .loads ((ROOT_DIR / "test-schema.json" ).read_text ())
39
- OUTPUTTESTSUITE_SCHEMA = json .loads ((ROOT_DIR / "output-test-schema.json" ).read_text ())
38
+ TEST_SCHEMA = json .loads (ROOT_DIR .joinpath ("test-schema.json" ).read_text ())
39
+ OUTPUT_TEST_SCHEMA = json .loads (
40
+ ROOT_DIR .joinpath ("output-test-schema.json" ).read_text (),
41
+ )
40
42
41
43
42
44
def files (paths ):
@@ -69,7 +71,7 @@ def collect(root_dir):
69
71
"""
70
72
All of the test file paths within the given root directory, recursively.
71
73
"""
72
- return root_dir .glob ( "**/ *.json" )
74
+ return root_dir .rglob ( " *.json" )
73
75
74
76
75
77
def url_for_path (path ):
@@ -138,33 +140,11 @@ class SanityTests(unittest.TestCase):
138
140
self .assertNotRegex (description , r"\bshould\b" , message )
139
141
self .assertNotRegex (description , r"(?i)\btest(s)? that\b" , message )
140
142
141
- def test_all_test_files_are_valid_json (self ):
142
- """
143
- All test files contain valid JSON.
144
- """
145
- for path in self .test_files :
146
- with self .subTest (path = path ):
147
- try :
148
- json .loads (path .read_text ())
149
- except ValueError as error :
150
- self .fail (f"{ path } contains invalid JSON ({ error } )" )
151
-
152
- def test_all_output_test_files_are_valid_json (self ):
153
- """
154
- All test files contain valid JSON.
155
- """
156
- for path in self .output_test_files :
157
- with self .subTest (path = path ):
158
- try :
159
- json .loads (path .read_text ())
160
- except ValueError as error :
161
- self .fail (f"{ path } contains invalid JSON ({ error } )" )
162
-
163
- def test_all_remote_files_are_valid_json (self ):
143
+ def test_all_json_files_are_valid (self ):
164
144
"""
165
- All remote files contain valid JSON.
145
+ All files (tests, output tests, remotes, etc.) contain valid JSON.
166
146
"""
167
- for path in self . remote_files :
147
+ for path in collect ( ROOT_DIR ) :
168
148
with self .subTest (path = path ):
169
149
try :
170
150
json .loads (path .read_text ())
0 commit comments