[Git][reproducible-builds/diffoscope][master] tests: pgp: support pgpdump 0.34
Mattia Rizzolo (@mattia)
gitlab at salsa.debian.org
Sun Dec 12 17:21:51 UTC 2021
Mattia Rizzolo pushed to branch master at Reproducible Builds / diffoscope
Commits:
962e3e2d by Mattia Rizzolo at 2021-12-12T18:19:27+01:00
tests: pgp: support pgpdump 0.34
Fixes: reproducible-builds/diffoscope#296
Thanks: Michael Weiss <dev.primeos at gmail.com> for reporting and testing the fix
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
1 changed file:
- tests/comparators/test_pgp.py
Changes:
=====================================
tests/comparators/test_pgp.py
=====================================
@@ -16,12 +16,15 @@
# You should have received a copy of the GNU General Public License
# along with diffoscope. If not, see <https://www.gnu.org/licenses/>.
+import re
import pytest
+import subprocess
from diffoscope.comparators.pgp import PgpFile, PgpSignature
-from ..utils.data import load_fixture, assert_diff
+from ..utils.data import load_fixture, assert_diff, get_data
from ..utils.tools import skip_unless_tools_exist
+from ..utils.versions import Version
from ..utils.nonexisting import assert_non_existing
pgp1 = load_fixture("test1.pgp")
@@ -41,6 +44,18 @@ def test_no_differences(pgp1):
assert difference is None
+def pgpdump_version():
+ out = subprocess.check_output(
+ ("pgpdump", "-v"), stderr=subprocess.STDOUT
+ ).decode("utf-8")
+ # pgpdump version 0.33, Copyright (C) 1998-2017 Kazu Yamamoto
+ m = re.search(r"^pgpdump version (?P<version>\d+\.\d+)", out)
+ if m is None:
+ raise ValueError(f"Error parsing `pgpdump -v` output: {out}")
+
+ return Version(m.group("version"))
+
+
@pytest.fixture
def differences(pgp1, pgp2):
return pgp1.compare(pgp2).details
@@ -81,4 +96,8 @@ def signed_differences(signed1, signed2):
@skip_unless_tools_exist("pgpdump")
def test_signed_diff(signed_differences):
- assert_diff(signed_differences[0], "pgp_signed_expected_diff")
+ expected_diff = get_data("pgp_signed_expected_diff")
+ if pgpdump_version() > Version(0.33):
+ expected_diff = expected_diff.replace("Format - binary", "Packet data format - binary")
+ expected_diff = expected_diff.replace("File modified time", "Creation time")
+ assert signed_differences[0].unified_diff == expected_diff
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/962e3e2d86a47f4cfccd1f7e93e7992a7235bdf0
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/962e3e2d86a47f4cfccd1f7e93e7992a7235bdf0
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/20211212/b98d6d83/attachment.htm>
More information about the rb-commits
mailing list