[diffoscope] 03/03: tests: skip test_squashfs.py.test_superblock if squashfs is too old

Mattia Rizzolo mattia at debian.org
Mon Aug 22 15:23:54 CEST 2016


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

mattia pushed a commit to branch master
in repository diffoscope.

commit 156e891e5e93652e565f59541d030602d5bf2122
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Mon Aug 22 13:21:00 2016 +0000

    tests: skip test_squashfs.py.test_superblock if squashfs is too old
---
 tests/comparators/test_squashfs.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/tests/comparators/test_squashfs.py b/tests/comparators/test_squashfs.py
index 3310927..a6d877e 100644
--- a/tests/comparators/test_squashfs.py
+++ b/tests/comparators/test_squashfs.py
@@ -18,11 +18,21 @@
 # along with diffoscope.  If not, see <http://www.gnu.org/licenses/>.
 
 import pytest
+import subprocess
 
 from diffoscope.comparators.squashfs import SquashfsFile
 
 from utils import skip_unless_tools_exist, data, load_fixture, \
-    assert_non_existing
+    assert_non_existing, skip_unless_tool_is_older_than
+
+def unsquashfs_version():
+    # first line of 'unsquashfs -version' looks like:
+    #   unsquashfs version 4.2-git (2013/03/13)
+    try:
+        out = subprocess.check_output(['unsquashfs', '-version'])
+    except subprocess.CalledProcessError as e:
+        out = e.output
+    return out.decode('UTF-8').splitlines()[0].split()[2].strip()
 
 squashfs1 = load_fixture(data('test1.squashfs'))
 squashfs2 = load_fixture(data('test2.squashfs'))
@@ -43,7 +53,7 @@ def test_no_warnings(capfd, squashfs1, squashfs2):
 def differences(squashfs1, squashfs2):
     return squashfs1.compare(squashfs2).details
 
- at skip_unless_tools_exist('unsquashfs')
+ at skip_unless_tool_is_older_than('unsquashfs', unsquashfs_version, '4.3')
 def test_superblock(differences):
     expected_diff = open(data('squashfs_superblock_expected_diff')).read()
     assert differences[0].unified_diff == expected_diff

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


More information about the diffoscope mailing list