Skip to content

Commit a2d2de0

Browse files
committed
improve output consistency
1 parent 56c1ad8 commit a2d2de0

4 files changed

Lines changed: 461 additions & 454 deletions

File tree

‎src/etc/debugger_tester/common.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,13 @@ def save_blessing(self, metadata: BlessMetadata):
551551

552552
self.bless_metadata = metadata
553553
path = os.environ["DEBUGGER_TESTER_INPUT_DATA_PATH"]
554+
555+
# We first sort the types dictionary. This keeps the git diff more consistent, and doesn't
556+
# affect runtime behavior at all.
557+
import operator
558+
559+
self.types = dict(sorted(self.types.items(), key=operator.itemgetter(0)))
560+
554561
# dumping directly to a file is somewhat unsafe. If the `Variable`/`Type` data ends up in a
555562
# state that cannot be serialized correctly, the json ends up malformed, and we could end up
556563
# overwriting valid test data with a complete mess. Since the in-memory data is typically
@@ -567,7 +574,7 @@ def save_blessing(self, metadata: BlessMetadata):
567574

568575
os.makedirs(pathlib.Path(path).parent, exist_ok=True)
569576

570-
with open(path, "w") as f:
577+
with open(path, "w", newline="\n") as f:
571578
f.write(x)
572579
f.write("\n")
573580

0 commit comments

Comments
 (0)