[diffoscope] 05/06: Don't assume default group is the same name as the user in test_listing.

Chris Lamb chris at chris-lamb.co.uk
Sun Aug 14 11:31:50 CEST 2016


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

lamby pushed a commit to branch master
in repository diffoscope.

commit 4620600bf47a978a3cdfc710972f3f8501dfa5e0
Author: Chris Lamb <lamby at debian.org>
Date:   Sun Aug 14 10:10:46 2016 +0100

    Don't assume default group is the same name as the user in test_listing.
---
 tests/comparators/test_squashfs.py           |  3 +++
 tests/data/squashfs_listing_expected_diff.in | 12 ++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/tests/comparators/test_squashfs.py b/tests/comparators/test_squashfs.py
index fad1c61..12522e3 100644
--- a/tests/comparators/test_squashfs.py
+++ b/tests/comparators/test_squashfs.py
@@ -19,6 +19,7 @@
 
 import os.path
 import pwd
+import grp
 import pytest
 import multiprocessing
 from diffoscope.comparators import specialize
@@ -60,12 +61,14 @@ def test_superblock(differences):
     assert differences[0].unified_diff == expected_diff
 
 @pytest.mark.skipif(try_except(lambda: 1000 not in {x.pw_uid for x in pwd.getpwall()}, True, KeyError), reason="No uid 1000")
+ at pytest.mark.skipif(try_except(lambda: 1000 not in {x.gr_gid for x in grp.getgrall()}, True, KeyError), reason="No gid 1000")
 @pytest.mark.skipif(tool_missing('unsquashfs'), reason='missing unsquashfs')
 def test_listing(differences):
     expected_diff = open(os.path.join(os.path.dirname(__file__), '../data/squashfs_listing_expected_diff.in')).read()
     # Workaround #794096
     for x, y in (
         ('$USER', pwd.getpwuid(1000).pw_name),
+        ('$GROUP', grp.getgrgid(1000).gr_name),
         ('$NUM_PROCESSORS', str(multiprocessing.cpu_count())),
     ):
         expected_diff = expected_diff.replace(x, y)
diff --git a/tests/data/squashfs_listing_expected_diff.in b/tests/data/squashfs_listing_expected_diff.in
index 6914195..b8e906b 100644
--- a/tests/data/squashfs_listing_expected_diff.in
+++ b/tests/data/squashfs_listing_expected_diff.in
@@ -2,10 +2,10 @@
  Parallel unsquashfs: Using $NUM_PROCESSORS processors
  3 inodes (3 blocks) to write
  
--drwxr-xr-x $USER/$USER              51 2015-06-24 14:47 
--lrwxrwxrwx $USER/$USER               6 2015-06-24 14:47 /link -> broken
-+drwxr-xr-x $USER/$USER              51 2015-06-24 14:50 
-+lrwxrwxrwx $USER/$USER              13 2015-06-24 14:50 /link -> really-broken
+-drwxr-xr-x $USER/$GROUP              51 2015-06-24 14:47 
+-lrwxrwxrwx $USER/$GROUP               6 2015-06-24 14:47 /link -> broken
++drwxr-xr-x $USER/$GROUP              51 2015-06-24 14:50 
++lrwxrwxrwx $USER/$GROUP              13 2015-06-24 14:50 /link -> really-broken
  crw-r--r-- root/root             1,  3 2015-06-24 14:47 /null
---rw-r--r-- $USER/$USER             446 2015-06-24 14:49 /text
-+-rw-r--r-- $USER/$USER             671 2015-06-24 14:49 /text
+--rw-r--r-- $USER/$GROUP             446 2015-06-24 14:49 /text
++-rw-r--r-- $USER/$GROUP             671 2015-06-24 14:49 /text

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


More information about the diffoscope mailing list