[Git][reproducible-builds/diffoscope][master] Amend 7zip version test for older 7z versions that include "[64]" string. (Closes: #376)

Chris Lamb (@lamby) gitlab at salsa.debian.org
Sun May 26 09:16:17 UTC 2024



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
2a361d7d by Sergei Trofimovich at 2024-05-26T10:15:13+01:00
Amend 7zip version test for older 7z versions that include "[64]" string. (Closes: #376)

Without the change `7z` test fails with assertion errors:

    FAILED tests/comparators/test_sevenz.py::test_metadata_diff - AssertionError

This happens because version guard did not work for my ancient `7z`:

    $ 7z | head -n2

    7-Zip [64] 17.05 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28

THe change attempts to skip `[64]` identifier. Tested on 7z 17.05 only.

- - - - -


1 changed file:

- tests/comparators/test_sevenz.py


Changes:

=====================================
tests/comparators/test_sevenz.py
=====================================
@@ -38,7 +38,12 @@ def sevenz_version():
         out = subprocess.check_output(["7z"])
     except subprocess.CalledProcessError as e:
         out = e.output
-    return out.decode("UTF-8").split()[1].strip()
+    words = out.decode("UTF-8").split()
+    # 7zip 17.04 returns version after "[64]" identifier:
+    #   "7-Zip [64] 17.05 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28"
+    if words[1].startswith("["):
+        return words[2].strip()
+    return words[1].strip()
 
 
 def test_identification(sevenza):



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

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/2a361d7dff135d3e832161f587a55a62fcbec9f2
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/20240526/ea254147/attachment.htm>


More information about the rb-commits mailing list