From 435a8fe9a201a7e74e705e06cc56b66fa6cb4af9 Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Tue, 1 Aug 2023 11:11:13 +0100 Subject: [PATCH] Fix compataibility with file 5.45. (Closes: reproducible-builds/diffoscope#346) --- tests/comparators/test_cpio.py | 19 ++++++++++++------- tests/comparators/test_uimage.py | 20 +++++++++++++------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/tests/comparators/test_cpio.py b/tests/comparators/test_cpio.py index fce0b9b3..022aede7 100644 --- a/tests/comparators/test_cpio.py +++ b/tests/comparators/test_cpio.py @@ -22,7 +22,10 @@ import pytest from diffoscope.comparators.cpio import CpioFile from ..utils.data import load_fixture, get_data -from ..utils.tools import skip_unless_tools_exist +from ..utils.tools import ( + skip_unless_tools_exist, + skip_unless_file_version_is_at_least, +) from ..utils.nonexisting import assert_non_existing cpio1 = load_fixture("test1.cpio") @@ -51,19 +54,21 @@ def test_listing(differences): @skip_unless_tools_exist("cpio") +@skip_unless_file_version_is_at_least("5.45") def test_symlink(differences): - assert differences[1].source1 == "dir/link" - assert differences[1].comment == "symlink" + assert differences[2].source1 == "dir/link" + assert differences[2].comment == "symlink" expected_diff = get_data("symlink_expected_diff") - assert differences[1].unified_diff == expected_diff + assert differences[2].unified_diff == expected_diff @skip_unless_tools_exist("cpio") +@skip_unless_file_version_is_at_least("5.45") def test_compressed_files(differences): - assert differences[2].source1 == "dir/text" - assert differences[2].source2 == "dir/text" + assert differences[3].source1 == "dir/text" + assert differences[3].source2 == "dir/text" expected_diff = get_data("text_ascii_expected_diff") - assert differences[2].unified_diff == expected_diff + assert differences[3].unified_diff == expected_diff @skip_unless_tools_exist("cpio") diff --git a/tests/comparators/test_uimage.py b/tests/comparators/test_uimage.py index 9ffcdc6f..2a8574ff 100644 --- a/tests/comparators/test_uimage.py +++ b/tests/comparators/test_uimage.py @@ -24,7 +24,11 @@ from diffoscope.comparators.uimage import UimageFile from diffoscope.comparators.utils.specialize import specialize from ..utils.data import load_fixture, get_data, assert_diff -from ..utils.tools import skip_unless_tools_exist, file_version_is_lt +from ..utils.tools import ( + skip_unless_tools_exist, + file_version_is_lt, + skip_unless_file_version_is_at_least, +) from ..utils.nonexisting import assert_non_existing cpio1 = load_fixture("test1.cpio") @@ -113,19 +117,21 @@ def test_nested_listing(nested_differences): @skip_unless_tools_exist("cpio") +@skip_unless_file_version_is_at_least("5.45") def test_nested_symlink(nested_differences): - assert nested_differences[1].source1 == "dir/link" - assert nested_differences[1].comment == "symlink" + assert nested_differences[2].source1 == "dir/link" + assert nested_differences[2].comment == "symlink" expected_diff = get_data("symlink_expected_diff") - assert nested_differences[1].unified_diff == expected_diff + assert nested_differences[2].unified_diff == expected_diff @skip_unless_tools_exist("cpio") +@skip_unless_file_version_is_at_least("5.45") def test_nested_compressed_files(nested_differences): - assert nested_differences[2].source1 == "dir/text" - assert nested_differences[2].source2 == "dir/text" + assert nested_differences[3].source1 == "dir/text" + assert nested_differences[3].source2 == "dir/text" expected_diff = get_data("text_ascii_expected_diff") - assert nested_differences[2].unified_diff == expected_diff + assert nested_differences[3].unified_diff == expected_diff @skip_unless_tools_exist("cpio") -- GitLab