[Git][reproducible-builds/diffoscope][master] When pretty-printing JSON, mark the difference as such, additionally avoiding...
Chris Lamb (@lamby)
gitlab at salsa.debian.org
Thu Nov 18 17:54:50 UTC 2021
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
0c907dc8 by Chris Lamb at 2021-11-18T09:54:31-08:00
When pretty-printing JSON, mark the difference as such, additionally avoiding including the full path. (Closes: reproducible-builds/diffoscope#205)
- - - - -
2 changed files:
- diffoscope/comparators/json.py
- tests/utils/nonexisting.py
Changes:
=====================================
diffoscope/comparators/json.py
=====================================
@@ -58,7 +58,11 @@ class JSONFile(File):
def compare_details(self, other, source=None):
difference = Difference.from_text(
- self.dumps(self), self.dumps(other), self.path, other.path
+ self.dumps(self),
+ self.dumps(other),
+ self.path,
+ other.path,
+ source="Pretty-printed",
)
if difference:
@@ -71,6 +75,7 @@ class JSONFile(File):
self.dumps(other, sort_keys=False),
self.path,
other.path,
+ source="Pretty-printed",
comment="ordering differences only",
)
=====================================
tests/utils/nonexisting.py
=====================================
@@ -32,4 +32,7 @@ def assert_non_existing(
assert difference.source2 == "/nonexisting"
assert not has_details or len(difference.details) > 0
- assert not has_null_source or difference.details[-1].source2 == "/dev/null"
+ assert not has_null_source or (
+ difference.details[-1].source2 == "/dev/null"
+ or difference.source2 == "/nonexisting"
+ )
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/0c907dc8a6ba2f165f11c53eb454d895122617b3
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/0c907dc8a6ba2f165f11c53eb454d895122617b3
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20211118/db7627f4/attachment.htm>
More information about the rb-commits
mailing list