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?
#! /usr/bin/env python
from __future__ import print_function
+from pprint import pformat
import argparse
import errno
import fnmatch
@@ -140,11 +141,38 @@ class SanityTests(unittest.TestCase):
with open(absolute_path) as schema_file:
files[absolute_path] = json.load(schema_file)
- self.assertEqual(
- files, {
+ expected = {
os.path.join(REMOTES_DIR, path): contents
for path, contents in REMOTES.iteritems()
- },
+ }
+
+ missing = set(files).symmetric_difference(expected)
+ changed = {
+ path
+ for path, contents in expected.items()
+ if path in files
+ and contents != files[path]
+ }
+
+ self.assertEqual(
+ files,
+ expected,
+ msg=textwrap.dedent(
+ """
+ Remotes in the remotes/ directory do not match those in the
+ ``jsonschema_suite`` Python script.
+
+ Unfortunately for the minute, each remote file is duplicated in
+ two places.""" + ("""
+
+ Only present in one location:
+
+ {}""".format("\n".join(missing)) if missing else "") + ("""
+
+ Conflicting between the two:
+
+ {}""".format("\n".join(changed)) if changed else "")
+ )
)
