[diffoscope] 01/01: comparators/directory: actually fix #868534 by expecting less strict test output

Ximin Luo infinity0 at debian.org
Mon Jul 17 11:20:00 CEST 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository diffoscope.

commit 041c2b8356aae6005cd2d815a1233c4d00eccad7
Author: Ximin Luo <infinity0 at debian.org>
Date:   Mon Jul 17 11:17:41 2017 +0200

    comparators/directory: actually fix #868534 by expecting less strict test output
    
    The try clause really does nothing (and leaks logic from another part of the
    program into this one), remove it.
---
 diffoscope/comparators/directory.py | 21 +++++++++------------
 tests/test_main.py                  |  4 +++-
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/diffoscope/comparators/directory.py b/diffoscope/comparators/directory.py
index 4e5993a..b88dbb4 100644
--- a/diffoscope/comparators/directory.py
+++ b/diffoscope/comparators/directory.py
@@ -179,18 +179,15 @@ class FilesystemDirectory(Directory):
     def compare(self, other, source=None):
         differences = []
 
-        try:
-            listing_diff = Difference.from_text(
-                '\n'.join(list_files(self.path)),
-                '\n'.join(list_files(other.path)),
-                self.path,
-                other.path,
-                source='file list',
-            )
-            if listing_diff:
-                differences.append(listing_diff)
-        except RequiredToolNotFound:
-            logger.info("Unable to find 'getfacl'.")
+        listing_diff = Difference.from_text(
+            '\n'.join(list_files(self.path)),
+            '\n'.join(list_files(other.path)),
+            self.path,
+            other.path,
+            source='file list',
+        )
+        if listing_diff:
+            differences.append(listing_diff)
 
         differences.extend(compare_meta(self.name, other.name))
 
diff --git a/tests/test_main.py b/tests/test_main.py
index a6a4770..dbb5e91 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -114,7 +114,9 @@ def test_no_differences_directories(capsys, tmpdir):
     ret, out, err = run(capsys, create_dir('a'), create_dir('b'))
 
     assert ret == 0
-    assert err == ''
+    # if getfacl is not available there will be a warning message on stderr
+    # if it's available then err should be empty
+    assert err == '' or "getfacl" in err
     assert out == ''
 
 def test_list_tools(capsys):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list