Skip to content

Commit 12a62ba

Browse files
committed
Show a more helpful message when someone forgets to update both remotes locations.
I still hope this goes away entirely sometime soon. Does code write itself?
1 parent 812ba48 commit 12a62ba

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

bin/jsonschema_suite

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#! /usr/bin/env python
22
from __future__ import print_function
3+
from pprint import pformat
34
import argparse
45
import errno
56
import fnmatch
@@ -140,11 +141,38 @@ class SanityTests(unittest.TestCase):
140141
with open(absolute_path) as schema_file:
141142
files[absolute_path] = json.load(schema_file)
142143

144+
expected = {
145+
os.path.join(REMOTES_DIR, path): contents
146+
for path, contents in REMOTES.iteritems()
147+
}
148+
149+
missing = set(files).symmetric_difference(expected)
150+
changed = {
151+
path
152+
for path, contents in expected.items()
153+
if path in files
154+
and contents != files[path]
155+
}
156+
143157
self.assertEqual(
144-
files, {
145-
os.path.join(REMOTES_DIR, path): contents
146-
for path, contents in REMOTES.iteritems()
147-
},
158+
files,
159+
expected,
160+
msg=textwrap.dedent(
161+
"""
162+
Remotes in the remotes/ directory do not match those in the
163+
``jsonschema_suite`` Python script.
164+
165+
Unfortunately for the minute, each remote file is duplicated in
166+
two places.""" + ("""
167+
168+
Only present in one location:
169+
170+
{}""".format("\n".join(missing)) if missing else "") + ("""
171+
172+
Conflicting between the two:
173+
174+
{}""".format("\n".join(changed)) if changed else "")
175+
)
148176
)
149177

150178

0 commit comments

Comments
 (0)