Skip to content

Commit a8b2805

Browse files
committed
Minor style tweaks.
1 parent 3413863 commit a8b2805

File tree

1 file changed

+8
-28
lines changed

1 file changed

+8
-28
lines changed

bin/jsonschema_suite

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ OUTPUT_ROOT_DIR = ROOT_DIR / "output-tests"
3535
REMOTES_DIR = ROOT_DIR / "remotes"
3636
REMOTES_BASE_URL = "http://localhost:1234/"
3737

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+
)
4042

4143

4244
def files(paths):
@@ -69,7 +71,7 @@ def collect(root_dir):
6971
"""
7072
All of the test file paths within the given root directory, recursively.
7173
"""
72-
return root_dir.glob("**/*.json")
74+
return root_dir.rglob("*.json")
7375

7476

7577
def url_for_path(path):
@@ -138,33 +140,11 @@ class SanityTests(unittest.TestCase):
138140
self.assertNotRegex(description, r"\bshould\b", message)
139141
self.assertNotRegex(description, r"(?i)\btest(s)? that\b", message)
140142

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):
164144
"""
165-
All remote files contain valid JSON.
145+
All files (tests, output tests, remotes, etc.) contain valid JSON.
166146
"""
167-
for path in self.remote_files:
147+
for path in collect(ROOT_DIR):
168148
with self.subTest(path=path):
169149
try:
170150
json.loads(path.read_text())

0 commit comments

Comments
 (0)