[Git][reproducible-builds/diffoscope][master] 2 commits: Add an allowed-to-fail test regarding a regression in directory handling.

Chris Lamb (@lamby) gitlab at salsa.debian.org
Fri Feb 4 16:12:39 UTC 2022



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
ceb90b5d by Chris Lamb at 2022-02-01T09:27:36-08:00
Add an allowed-to-fail test regarding a regression in directory handling.

- - - - -
c2be3195 by Chris Lamb at 2022-02-04T08:12:20-08:00
Tidy control flow in Difference._reverse_self a little.

- - - - -


2 changed files:

- diffoscope/difference.py
- tests/comparators/test_directory.py


Changes:

=====================================
diffoscope/difference.py
=====================================
@@ -116,11 +116,11 @@ class Difference:
             raise NotImplementedError(
                 "_reverse_self on VisualDifference is not yet implemented"
             )
-        unified_diff = (
-            reverse_unified_diff(self.unified_diff)
-            if self.unified_diff is not None
-            else None
-        )
+
+        unified_diff = None
+        if self.unified_diff is not None:
+            unified_diff = reverse_unified_diff(self.unified_diff)
+
         return self.__class__(
             self.source2,
             self.source1,


=====================================
tests/comparators/test_directory.py
=====================================
@@ -111,3 +111,16 @@ def test_compare_to_dangling_symlink(tmpdir):
     b = specialize(FilesystemFile(path))
 
     assert a.compare(b).unified_diff == get_data("test_directory_symlink_diff")
+
+
+ at pytest.mark.xfail(strict=False)
+def test_compare_both_ways(tmpdir):
+    """
+    Comparing a directory with a file shouldn't crash, but nor should as
+    comparing a file with a directory either. (Re: #292)
+    """
+
+    a = specialize(FilesystemFile(str(tmpdir)))
+    b = specialize(FilesystemFile(TEST_FILE1_PATH))
+    a.compare(b)
+    b.compare(a)



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/5269c1c0ed8ed29eeb609ac979a6aabeb1743916...c2be319586dccc4a8945323f1f442b2ecb49d844

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/5269c1c0ed8ed29eeb609ac979a6aabeb1743916...c2be319586dccc4a8945323f1f442b2ecb49d844
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/20220204/a9f25f48/attachment.htm>


More information about the rb-commits mailing list