[Git][reproducible-builds/diffoscope][master] Fix tests for 7zip 24.05.

Chris Lamb (@lamby) gitlab at salsa.debian.org
Mon May 20 12:39:07 UTC 2024



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
31a6a56a by Chris Lamb at 2024-05-20T13:37:40+01:00
Fix tests for 7zip 24.05.

- - - - -


2 changed files:

- tests/comparators/test_sevenz.py
- tests/data/text_sevenzmetadata_expected_diff


Changes:

=====================================
tests/comparators/test_sevenz.py
=====================================
@@ -16,8 +16,9 @@
 # You should have received a copy of the GNU General Public License
 # along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.
 
-import shutil
 import pytest
+import shutil
+import subprocess
 
 from diffoscope.comparators.gzip import GzipFile
 from diffoscope.comparators.sevenz import SevenZFile
@@ -25,13 +26,21 @@ from diffoscope.comparators.binary import FilesystemFile
 from diffoscope.comparators.utils.specialize import specialize
 
 from ..utils.data import load_fixture, assert_diff
-from ..utils.tools import skip_unless_tools_exist
+from ..utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least
 from ..utils.nonexisting import assert_non_existing
 
 sevenza = load_fixture("test1.disk.gz")
 sevenzb = load_fixture("test2.disk.gz")
 
 
+def sevenz_version():
+    try:
+        out = subprocess.check_output(["7z"])
+    except subprocess.CalledProcessError as e:
+        out = e.output
+    return out.decode("UTF-8").split()[1].strip()
+
+
 def test_identification(sevenza):
     assert isinstance(sevenza, GzipFile)
 
@@ -69,6 +78,7 @@ def test_content_source_without_extension(tmpdir, sevenza, sevenzb):
 
 
 @skip_unless_tools_exist("7z")
+ at skip_unless_tool_is_at_least("7z", sevenz_version, "24.05")
 def test_metadata_diff(differences):
     assert_diff(differences[0].details[0], "text_sevenzmetadata_expected_diff")
 


=====================================
tests/data/text_sevenzmetadata_expected_diff
=====================================
@@ -1,11 +1,11 @@
-@@ -5,13 +5,13 @@
- Scanning the drive for archives:
+@@ -6,13 +6,13 @@
  1 file, 131072 bytes (128 KiB)
  
  
  --
  Type = GPT
  Physical Size = 131072
+ Sector Size = 512
 -ID = BEFEFA22-EED4-4977-8407-46CD48ABC5D9
 +ID = A2E15781-E1B6-422C-BA65-9210D36BE3AA
  



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/31a6a56a4a04530d428c2526b386b988c8064924

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/31a6a56a4a04530d428c2526b386b988c8064924
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/20240520/5cfa2663/attachment.htm>


More information about the rb-commits mailing list