tests:skip tests with diffs made with file,gz<5.36

Tests that use control files using diffs created with file version
before 5.37 containing gzipped files will fail due to its output being
changed:

    tests/data/test1.gz: gzip compressed [...] original size modulo 2^32 446

vs file < 5.36

    tests/data/test1.gz: gzip compressed [...] original size 446

Add a new decorator that ensures not only the minimum version of file is
used, but also that the maximum version of file is under 5.37. This
change in file was introduced in the following commit:

 https://github.com/file/file/commit/3c12eb8d1418181af93abdd466c64dcddf68ce16Signed-off-by: 's avatarSantiago Torres <santiago@archlinux.org>
parent 6058abd4
Pipeline #47494 failed with stage
in 15 minutes and 40 seconds
...@@ -24,7 +24,7 @@ import itertools ...@@ -24,7 +24,7 @@ import itertools
from ..utils.data import load_fixture, get_data from ..utils.data import load_fixture, get_data
from ..utils.tools import ( from ..utils.tools import (
skip_unless_tools_exist, skip_unless_tools_exist,
skip_unless_file_version_is_at_least, skip_unless_file_version_is_between,
) )
gzip1 = load_fixture('containers/a.tar.gz') gzip1 = load_fixture('containers/a.tar.gz')
...@@ -66,7 +66,7 @@ def expected_type_diff(ext1, ext2): ...@@ -66,7 +66,7 @@ def expected_type_diff(ext1, ext2):
@skip_unless_tools_exist('xz') @skip_unless_tools_exist('xz')
@skip_unless_file_version_is_at_least('5.33') @skip_unless_file_version_is_between('5.33', '5.36')
def test_equal(set1): def test_equal(set1):
for x, y in itertools.product(TYPES, TYPES): for x, y in itertools.product(TYPES, TYPES):
diff = set1[x].compare(set1[y]) diff = set1[x].compare(set1[y])
...@@ -84,7 +84,7 @@ def test_equal(set1): ...@@ -84,7 +84,7 @@ def test_equal(set1):
@skip_unless_tools_exist('xz') @skip_unless_tools_exist('xz')
@skip_unless_file_version_is_at_least('5.33') @skip_unless_file_version_is_between('5.33', '5.36')
def test_different(set1, set2): def test_different(set1, set2):
for x, y in itertools.product(TYPES, TYPES): for x, y in itertools.product(TYPES, TYPES):
expected_diff = get_data('containers/different_files_expected_diff') expected_diff = get_data('containers/different_files_expected_diff')
......
...@@ -30,7 +30,7 @@ from diffoscope.comparators.utils.specialize import ( ...@@ -30,7 +30,7 @@ from diffoscope.comparators.utils.specialize import (
) )
from ..utils.data import load_fixture, get_data from ..utils.data import load_fixture, get_data
from ..utils.tools import skip_unless_file_version_is_at_least from ..utils.tools import skip_unless_file_version_is_between
gzip1 = load_fixture('test1.gz') gzip1 = load_fixture('test1.gz')
...@@ -61,7 +61,7 @@ def differences(gzip1, gzip2): ...@@ -61,7 +61,7 @@ def differences(gzip1, gzip2):
return gzip1.compare(gzip2).details return gzip1.compare(gzip2).details
@skip_unless_file_version_is_at_least('5.33') @skip_unless_file_version_is_between('5.33', '5.36')
def test_metadata(differences): def test_metadata(differences):
assert differences[0].source1.startswith('filetype') assert differences[0].source1.startswith('filetype')
assert differences[0].source2.startswith('filetype') assert differences[0].source2.startswith('filetype')
......
...@@ -24,7 +24,7 @@ from diffoscope.comparators.ipk import IpkFile ...@@ -24,7 +24,7 @@ from diffoscope.comparators.ipk import IpkFile
from diffoscope.comparators.missing_file import MissingFile from diffoscope.comparators.missing_file import MissingFile
from ..utils.data import load_fixture, get_data from ..utils.data import load_fixture, get_data
from ..utils.tools import skip_unless_file_version_is_at_least from ..utils.tools import skip_unless_file_version_is_between
ipk1 = load_fixture('base-files_157-r45695_ar71xx.ipk') ipk1 = load_fixture('base-files_157-r45695_ar71xx.ipk')
...@@ -45,7 +45,7 @@ def differences(ipk1, ipk2): ...@@ -45,7 +45,7 @@ def differences(ipk1, ipk2):
return ipk1.compare(ipk2).details return ipk1.compare(ipk2).details
@skip_unless_file_version_is_at_least('5.33') @skip_unless_file_version_is_between('5.33', '5.36')
def test_metadata(differences): def test_metadata(differences):
assert differences[0].source1.startswith('filetype') assert differences[0].source1.startswith('filetype')
expected_diff = get_data('ipk_metadata_expected_diff') expected_diff = get_data('ipk_metadata_expected_diff')
......
...@@ -34,7 +34,7 @@ from .utils import diff_expand ...@@ -34,7 +34,7 @@ from .utils import diff_expand
from .utils.data import cwd_data, data, get_data from .utils.data import cwd_data, data, get_data
from .utils.tools import ( from .utils.tools import (
skip_unless_tools_exist, skip_unless_tools_exist,
skip_unless_file_version_is_at_least, skip_unless_file_version_is_between
) )
re_html = re.compile( re_html = re.compile(
...@@ -86,7 +86,7 @@ def test_text_option_is_default(capsys): ...@@ -86,7 +86,7 @@ def test_text_option_is_default(capsys):
assert out == get_data('output.txt') assert out == get_data('output.txt')
@skip_unless_file_version_is_at_least('5.33') @skip_unless_file_version_is_between('5.33', '5.36')
def test_text_proper_indentation(capsys): def test_text_proper_indentation(capsys):
out = run(capsys, pair=('archive1.tar', 'archive2.tar')) out = run(capsys, pair=('archive1.tar', 'archive2.tar'))
......
...@@ -24,7 +24,7 @@ from diffoscope.comparators.zip import ZipFile ...@@ -24,7 +24,7 @@ from diffoscope.comparators.zip import ZipFile
from diffoscope.comparators.gzip import GzipFile from diffoscope.comparators.gzip import GzipFile
from .utils.data import load_fixture, get_data from .utils.data import load_fixture, get_data
from .utils.tools import skip_unless_file_version_is_at_least from .utils.tools import skip_unless_file_version_is_between
quine1 = load_fixture('quine.gz') quine1 = load_fixture('quine.gz')
quine2 = load_fixture('quine.zip') quine2 = load_fixture('quine.zip')
...@@ -52,7 +52,7 @@ def differences(quine1, quine2): ...@@ -52,7 +52,7 @@ def differences(quine1, quine2):
return quine1.compare(quine2).details return quine1.compare(quine2).details
@skip_unless_file_version_is_at_least('5.33') @skip_unless_file_version_is_between('5.33', '5.36')
def test_difference(differences): def test_difference(differences):
expected_diff = get_data('quine_expected_diff') expected_diff = get_data('quine_expected_diff')
assert differences[0].unified_diff == expected_diff assert differences[0].unified_diff == expected_diff
......
...@@ -193,3 +193,8 @@ def skip_unless_module_exists(name): ...@@ -193,3 +193,8 @@ def skip_unless_module_exists(name):
def skip_unless_file_version_is_at_least(version): def skip_unless_file_version_is_at_least(version):
return skip_unless_tool_is_at_least('file', file_version, version) return skip_unless_tool_is_at_least('file', file_version, version)
def skip_unless_file_version_is_between(min_version, max_version):
return skip_unless_tool_is_between('file', file_version, min_version,
max_version)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment