fix pep8 E302 in the tests

Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mattia@debian.org>
parent 9ea6a951
......@@ -29,25 +29,31 @@ apk1 = load_fixture('test1.apk')
apk2 = load_fixture('test2.apk')
apk3 = load_fixture('test3.apk')
def test_identification(apk1):
assert isinstance(apk1, ApkFile)
def test_no_differences(apk1):
difference = apk1.compare(apk1)
assert difference is None
@pytest.fixture
def differences(apk1, apk2):
return apk1.compare(apk2).details
@pytest.fixture
def differences2(apk1, apk3):
return apk1.compare(apk3).details
@skip_unless_tools_exist('apktool', 'zipinfo')
def test_compare_non_existing(monkeypatch, apk1):
assert_non_existing(monkeypatch, apk1)
@skip_unless_tools_exist('apktool', 'zipinfo')
def test_zipinfo(differences):
assert differences[0].source1 == 'zipinfo {}'
......@@ -55,6 +61,7 @@ def test_zipinfo(differences):
expected_diff = get_data('apk_zipinfo_expected_diff')
assert differences[0].unified_diff == expected_diff
@skip_unless_tools_exist('apktool', 'zipinfo')
def test_android_manifest(differences):
assert differences[1].source1 == 'AndroidManifest.xml (decoded)'
......@@ -62,11 +69,13 @@ def test_android_manifest(differences):
expected_diff = get_data('apk_manifest_expected_diff')
assert differences[1].details[0].unified_diff == expected_diff
@skip_unless_tools_exist('apktool', 'zipinfo')
def test_apk_metadata_source(differences):
assert differences[2].source1 == 'APK metadata'
assert differences[2].source2 == 'APK metadata'
@skip_unless_tools_exist('apktool', 'zipinfo')
def test_skip_undecoded_android_manifest(differences):
assert not any(difference.source1 == 'original/AndroidManifest.xml'
......@@ -79,6 +88,7 @@ def test_skip_undecoded_android_manifest(differences):
assert not any(difference.source2 == undecoded_manifest
for difference in differences)
@skip_unless_tools_exist('apktool', 'zipinfo')
def test_no_android_manifest(differences2):
undecoded_manifest = 'AndroidManifest.xml (original / undecoded)'
......
......@@ -25,10 +25,12 @@ from ..utils.data import load_fixture
archive1 = load_fixture('archive1.tar')
archive2 = load_fixture('archive2.tar')
@pytest.fixture
def differences(archive1, archive2):
return archive1.compare(archive2).details
def test_compressed_content_name(differences):
assert differences[1].details[1].source1 == 'compressed'
assert differences[1].details[1].source2 == 'compressed'
......@@ -46,56 +46,70 @@ TEST_ISO8859_PATH = data('text_iso8859')
binary1 = init_fixture(TEST_FILE1_PATH)
binary2 = init_fixture(TEST_FILE2_PATH)
def test_same_content(binary1):
assert binary1.has_same_content_as(binary1) is True
def test_not_same_content(binary1, binary2):
assert binary1.has_same_content_as(binary2) is False
def test_guess_file_type():
assert File.guess_file_type(TEST_FILE1_PATH) == 'data'
def test_guess_encoding_binary():
assert File.guess_encoding(TEST_FILE1_PATH) == 'binary'
def test_guess_encoding_ascii():
assert File.guess_encoding(TEST_ASCII_PATH) == 'us-ascii'
def test_guess_encoding_unicode():
assert File.guess_encoding(TEST_UNICODE_PATH) == 'utf-8'
def test_guess_encoding_iso8859():
assert File.guess_encoding(TEST_ISO8859_PATH) == 'iso-8859-1'
def test_no_differences_with_xxd(binary1):
difference = binary1.compare_bytes(binary1)
assert difference is None
@skip_unless_tools_exist('xxd')
def test_compare_with_xxd(binary1, binary2):
difference = binary1.compare_bytes(binary2)
expected_diff = get_data('binary_expected_diff')
assert normalize_zeros(difference.unified_diff) == expected_diff
def test_compare_non_existing_with_xxd(binary1):
difference = binary1.compare_bytes(MissingFile('/nonexisting', binary1))
assert difference.source2 == '/nonexisting'
@pytest.fixture
def xxd_not_found(monkeypatch):
def mock_cmdline(self):
raise RequiredToolNotFound('xxd')
monkeypatch.setattr(Xxd, 'cmdline', mock_cmdline)
def test_no_differences_without_xxd(xxd_not_found, binary1):
difference = binary1.compare_bytes(binary1)
assert difference is None
def test_compare_without_xxd(xxd_not_found, binary1, binary2):
difference = binary1.compare(binary2)
expected_diff = get_data('binary_hexdump_expected_diff')
assert difference.unified_diff == expected_diff
def test_with_compare_details():
d = Difference('diff', TEST_FILE1_PATH, TEST_FILE2_PATH, source='source')
......@@ -105,6 +119,7 @@ def test_with_compare_details():
difference = MockFile(TEST_FILE1_PATH).compare(MockFile(TEST_FILE2_PATH), source='source')
assert difference.details[0] == d
@skip_unless_tools_exist('xxd')
def test_with_compare_details_and_fallback():
class MockFile(FilesystemFile):
......@@ -115,6 +130,7 @@ def test_with_compare_details_and_fallback():
assert 'yet data differs' in difference.comment
assert normalize_zeros(difference.unified_diff) == expected_diff
def test_with_compare_details_and_no_actual_differences():
class MockFile(FilesystemFile):
def compare_details(self, other, source=None):
......@@ -122,6 +138,7 @@ def test_with_compare_details_and_no_actual_differences():
difference = MockFile(TEST_FILE1_PATH).compare(MockFile(TEST_FILE1_PATH))
assert difference is None
@skip_unless_tools_exist('xxd')
def test_with_compare_details_and_failed_process():
output = 'Free Jeremy Hammond'
......@@ -136,6 +153,7 @@ def test_with_compare_details_and_failed_process():
assert '42' in difference.comment
assert normalize_zeros(difference.unified_diff) == expected_diff
@skip_unless_tools_exist('xxd')
def test_with_compare_details_and_parsing_error():
from diffoscope.exc import OutputParsingError
......@@ -149,6 +167,7 @@ def test_with_compare_details_and_parsing_error():
assert 'Error parsing output' in difference.comment
assert normalize_zeros(difference.unified_diff) == expected_diff
@skip_unless_tools_exist('xxd')
def test_with_compare_details_and_extraction_error():
from diffoscope.exc import ContainerExtractionError
......@@ -162,6 +181,7 @@ def test_with_compare_details_and_extraction_error():
assert 'Error extracting' in difference.comment
assert normalize_zeros(difference.unified_diff) == expected_diff
@skip_unless_tools_exist('xxd')
@skip_unless_module_exists('distro')
def test_with_compare_details_and_tool_not_found(monkeypatch):
......@@ -187,12 +207,14 @@ def test_with_compare_details_and_tool_not_found(monkeypatch):
assert 'some-package' in difference.comment
assert normalize_zeros(difference.unified_diff) == expected_diff
def test_compare_two_nonexisting_files():
file1 = MissingFile('/nonexisting1')
file2 = MissingFile('/nonexisting2')
difference = file1.compare(file2)
assert 'non-existing' in difference.comment
def test_symlink_to_dir():
# Create 2 directories, each containing sub-directory src and symbolic link dst-->src.
with TemporaryDirectory() as basepath1:
......
......@@ -36,19 +36,23 @@ bzip2 = load_fixture('test2.bz2')
def test_identification(bzip1):
assert isinstance(bzip1, Bzip2File)
def test_no_differences(bzip1):
difference = bzip1.compare(bzip1)
assert difference is None
@pytest.fixture
def differences(bzip1, bzip2):
return bzip1.compare(bzip2).details
@skip_unless_tools_exist('bzip2')
def test_content_source(differences):
assert differences[0].source1 == 'test1'
assert differences[0].source2 == 'test2'
@skip_unless_tools_exist('bzip2')
def test_content_source_without_extension(tmpdir, bzip1, bzip2):
path1 = str(tmpdir.join('test1'))
......@@ -61,11 +65,13 @@ def test_content_source_without_extension(tmpdir, bzip1, bzip2):
assert differences[0].source1 == 'test1-content'
assert differences[0].source2 == 'test2-content'
@skip_unless_tools_exist('bzip2')
def test_content_diff(differences):
expected_diff = get_data('text_ascii_expected_diff')
assert differences[0].unified_diff == expected_diff
@skip_unless_tools_exist('bzip2')
def test_compare_non_existing(monkeypatch, bzip1):
assert_non_existing(monkeypatch, bzip1)
......@@ -33,31 +33,38 @@ from ..utils.data import load_fixture, get_data
deb1 = load_fixture('test1.deb')
deb2 = load_fixture('test2.deb')
def test_identification(deb1):
assert isinstance(deb1, DebFile)
def test_no_differences(deb1):
difference = deb1.compare(deb1)
assert difference is None
@pytest.fixture
def differences(deb1, deb2):
return deb1.compare(deb2).details
def test_metadata(differences):
expected_diff = get_data('deb_metadata_expected_diff')
assert differences[0].unified_diff == expected_diff
def test_compressed_files(differences):
assert differences[1].source1 == 'control.tar.gz'
assert differences[2].source1 == 'data.tar.gz'
def test_identification_of_md5sums_outside_deb(tmpdir):
path = str(tmpdir.join('md5sums'))
open(path, 'w')
f = specialize(FilesystemFile(path))
assert type(f) is FilesystemFile
def test_identification_of_md5sums_in_deb(deb1, deb2, monkeypatch):
orig_func = Md5sumsFile.recognizes
......@@ -72,13 +79,16 @@ def test_identification_of_md5sums_in_deb(deb1, deb2, monkeypatch):
deb1.compare(deb2)
assert test_identification_of_md5sums_in_deb.found
def test_md5sums(differences):
assert differences[1].details[0].details[1].details[0].comment == 'Files in package differ'
def test_identical_files_in_md5sums(deb1, deb2):
for name in ['./usr/share/doc/test/README.Debian', './usr/share/doc/test/copyright']:
assert deb1.md5sums[name] == deb2.md5sums[name]
def test_identification_of_data_tar(deb1, deb2, monkeypatch):
orig_func = DebDataTarFile.recognizes
......@@ -93,6 +103,7 @@ def test_identification_of_data_tar(deb1, deb2, monkeypatch):
deb1.compare(deb2)
assert test_identification_of_data_tar.found
def test_skip_comparison_of_known_identical_files(deb1, deb2, monkeypatch):
compared = set()
orig_func = diffoscope.comparators.utils.compare.compare_files
......@@ -104,6 +115,7 @@ def test_skip_comparison_of_known_identical_files(deb1, deb2, monkeypatch):
deb1.compare(deb2)
assert './usr/share/doc/test/README.Debian' not in compared
def test_compare_non_existing(monkeypatch, deb1):
monkeypatch.setattr(Config(), 'new_file', True)
difference = deb1.compare(MissingFile('/nonexisting', deb1))
......
......@@ -47,6 +47,7 @@ TEST_DOT_BUILDINFO_FILE2_PATH = data('test2.buildinfo')
TEST_DEB_FILE1_PATH = data('test1.deb')
TEST_DEB_FILE2_PATH = data('test2.deb')
@pytest.fixture
def dot_changes1(tmpdir):
tmpdir.mkdir('a')
......@@ -56,6 +57,7 @@ def dot_changes1(tmpdir):
shutil.copy(TEST_DOT_BUILDINFO_FILE1_PATH, str(tmpdir.join('a/test_1.buildinfo')))
return specialize(FilesystemFile(dot_changes_path))
@pytest.fixture
def dot_changes2(tmpdir):
tmpdir.mkdir('b')
......@@ -65,6 +67,7 @@ def dot_changes2(tmpdir):
shutil.copy(TEST_DOT_BUILDINFO_FILE2_PATH, str(tmpdir.join('b/test_2.buildinfo')))
return specialize(FilesystemFile(dot_changes_path))
@pytest.fixture
def dot_changes3(tmpdir):
tmpdir.mkdir('c')
......@@ -74,6 +77,7 @@ def dot_changes3(tmpdir):
shutil.copy(TEST_DOT_BUILDINFO_FILE2_PATH, str(tmpdir.join('c/test_2.buildinfo')))
return specialize(FilesystemFile(dot_changes_path))
@pytest.fixture
def dot_changes4(tmpdir):
tmpdir.mkdir('d')
......@@ -83,9 +87,11 @@ def dot_changes4(tmpdir):
shutil.copy(TEST_DOT_BUILDINFO_FILE1_PATH, str(tmpdir.join('d/test_2.buildinfo')))
return specialize(FilesystemFile(dot_changes_path))
def test_dot_changes_identification(dot_changes1):
assert isinstance(dot_changes1, DotChangesFile)
@skip_unless_module_exists('debian.deb822')
def test_dot_changes_invalid(tmpdir):
tmpdir.mkdir('a')
......@@ -95,42 +101,50 @@ def test_dot_changes_invalid(tmpdir):
identified = specialize(FilesystemFile(dot_changes_path))
assert not isinstance(identified, DotChangesFile)
def test_dot_changes_no_differences(dot_changes1):
difference = dot_changes1.compare(dot_changes1)
assert difference is None
@pytest.fixture
def dot_changes_differences(dot_changes1, dot_changes2):
difference = dot_changes1.compare(dot_changes2)
assert difference.source2 == '/nonexisting'
assert difference.details[-1].source2 == '/dev/null'
@pytest.fixture
def dot_changes_differences_identical_contents_and_identical_files(dot_changes1, dot_changes3):
difference = dot_changes1.compare(dot_changes3)
return difference.details
@pytest.fixture
def dot_changes_differences_identical_contents_and_different_files(dot_changes1, dot_changes4):
difference = dot_changes1.compare(dot_changes4)
return difference.details
@pytest.fixture
def dot_changes_differences_different_contents_and_identical_files(dot_changes2, dot_changes4):
difference = dot_changes4.compare(dot_changes2)
return difference.details
@skip_unless_module_exists('debian.deb822')
def test_dot_changes_no_differences_exclude_buildinfo(dot_changes1, dot_changes3):
difference = dot_changes1.compare(dot_changes3)
assert difference is None
@skip_unless_module_exists('debian.deb822')
def test_dot_changes_identical_contents_and_different_files(dot_changes_differences_identical_contents_and_different_files):
assert dot_changes_differences_identical_contents_and_different_files[0]
expected_diff = get_data('dot_changes_identical_contents_and_different_files_expected_diff')
assert dot_changes_differences_identical_contents_and_different_files[0].unified_diff == expected_diff
@skip_unless_module_exists('debian.deb822')
def test_dot_changes_different_contents_and_identical_files(dot_changes_differences_different_contents_and_identical_files):
assert dot_changes_differences_different_contents_and_identical_files[0]
......@@ -146,6 +160,7 @@ TEST_DOT_DSC_FILE2_PATH = data('test2.dsc')
TEST_DEB_SRC1_PATH = data('test1.debsrc.tar.gz')
TEST_DEB_SRC2_PATH = data('test2.debsrc.tar.gz')
@pytest.fixture
def dot_dsc1(tmpdir):
tmpdir.mkdir('a')
......@@ -154,6 +169,7 @@ def dot_dsc1(tmpdir):
shutil.copy(TEST_DEB_SRC1_PATH, str(tmpdir.join('a/test_1.tar.gz')))
return specialize(FilesystemFile(dot_dsc_path))
@pytest.fixture
def dot_dsc2(tmpdir):
tmpdir.mkdir('b')
......@@ -162,9 +178,11 @@ def dot_dsc2(tmpdir):
shutil.copy(TEST_DEB_SRC2_PATH, str(tmpdir.join('b/test_1.tar.gz')))
return specialize(FilesystemFile(dot_dsc_path))
def test_dot_dsc_identification(dot_dsc1):
assert isinstance(dot_dsc1, DotDscFile)
@skip_unless_module_exists('debian.deb822')
def test_dot_dsc_invalid(tmpdir, dot_dsc2):
tmpdir.mkdir('a')
......@@ -174,19 +192,23 @@ def test_dot_dsc_invalid(tmpdir, dot_dsc2):
identified = specialize(FilesystemFile(dot_dsc_path))
assert not isinstance(identified, DotDscFile)
def test_dot_dsc_no_differences(dot_dsc1):
difference = dot_dsc1.compare(dot_dsc1)
assert difference is None
@pytest.fixture
def dot_dsc_differences(dot_dsc1, dot_dsc2):
difference = dot_dsc1.compare(dot_dsc2)
return difference.details
@skip_unless_module_exists('debian.deb822')
def test_dot_dsc_internal_diff(dot_dsc_differences):
assert dot_dsc_differences[1].source1 == 'test_1.tar.gz'
@skip_unless_module_exists('debian.deb822')
def test_dot_dsc_compare_non_existing(monkeypatch, dot_dsc1):
monkeypatch.setattr(Config(), 'new_file', True)
......@@ -204,6 +226,7 @@ def dot_buildinfo1(tmpdir):
shutil.copy(TEST_DEB_FILE1_PATH, str(tmpdir.join('a/test_1_all.deb')))
return specialize(FilesystemFile(dot_buildinfo_path))
@pytest.fixture
def dot_buildinfo2(tmpdir):
tmpdir.mkdir('b')
......@@ -213,9 +236,11 @@ def dot_buildinfo2(tmpdir):
shutil.copy(TEST_DEB_FILE2_PATH, str(tmpdir.join('b/test_1_all.deb')))
return specialize(FilesystemFile(dot_buildinfo_path))
def test_dot_buildinfo_identification(dot_buildinfo1):
assert isinstance(dot_buildinfo1, DotBuildinfoFile)
@skip_unless_module_exists('debian.deb822')
def test_dot_buildinfo_invalid(tmpdir):
tmpdir.mkdir('a')
......@@ -225,23 +250,28 @@ def test_dot_buildinfo_invalid(tmpdir):
identified = specialize(FilesystemFile(dot_buildinfo_path))
assert not isinstance(identified, DotBuildinfoFile)
def test_dot_buildinfo_no_differences(dot_buildinfo1):
difference = dot_buildinfo1.compare(dot_buildinfo1)
assert difference is None
@pytest.fixture
def dot_buildinfo_differences(dot_buildinfo1, dot_buildinfo2):
difference = dot_buildinfo1.compare(dot_buildinfo2)
return difference.details
@skip_unless_module_exists('debian.deb822')
def test_dot_buildinfo_internal_diff(dot_buildinfo_differences):
assert dot_buildinfo_differences[1].source1 == 'test_1_all.deb'
@skip_unless_module_exists('debian.deb822')
def test_dot_buildinfo_compare_non_existing(monkeypatch, dot_buildinfo1):
assert_non_existing(monkeypatch, dot_buildinfo1)
def test_fallback_comparisons(monkeypatch):
manager = ComparatorManager()
monkeypatch.setattr(manager, 'COMPARATORS', (
......
......@@ -30,21 +30,26 @@ from ..utils.tools import skip_unless_tools_exist
text_ascii1 = load_fixture('text_ascii1')
@pytest.fixture
def devnull():
return specialize(FilesystemFile('/dev/null'))
@pytest.fixture
def differences(devnull, text_ascii1):
return devnull.compare_bytes(text_ascii1)
@pytest.fixture
def differences_reverse(text_ascii1, devnull):
return text_ascii1.compare_bytes(devnull)
def test_identification(devnull):
assert isinstance(devnull, Device)
@skip_unless_tools_exist('xxd')
def test_diff(differences):
if os.uname()[0] == 'FreeBSD':
......@@ -53,6 +58,7 @@ def test_diff(differences):
expected_diff = get_data('device_expected_diff')
assert normalize_zeros(differences.unified_diff) == expected_diff
@skip_unless_tools_exist('xxd')
def test_diff_reverse(differences_reverse):
if os.uname()[0] == 'FreeBSD':
......
......@@ -33,6 +33,7 @@ from .test_java import javap_version
dex1 = load_fixture('test1.dex')
dex2 = load_fixture('test2.dex')
def enjarify_version():
# Module enjarify.typeinference appeared in enjarify 1.0.3. We use a call
# directly to the python3 binary over importing with this module to escape
......@@ -44,17 +45,21 @@ def enjarify_version():
return '1.0.3'
return '1.0.2'
def test_identification(dex1):
assert isinstance(dex1, DexFile)
def test_no_differences(dex1):
difference = dex1.compare(dex1)
assert difference is None
@pytest.fixture
def differences(dex1, dex2):
return dex1.compare(dex2).details
@skip_unless_tools_exist('enjarify', 'zipinfo', 'javap')
@skip_unless_tool_is_at_least('javap', javap_version, '1.8')
@skip_unless_tool_is_at_least('enjarify', enjarify_version, '1.0.3')
......@@ -71,6 +76,7 @@ def test_differences(differences):
found_diff = zipinfo.unified_diff + classdiff.details[0].unified_diff
assert expected_diff == found_diff
@skip_unless_tools_exist('enjarify', 'zipinfo', 'javap')
def test_compare_non_existing(monkeypatch, dex1):
monkeypatch.setattr(Config(), 'new_file', True)
......
......@@ -32,14 +32,17 @@ from ..utils.data import data, get_data
TEST_FILE1_PATH = data('text_ascii1')
TEST_FILE2_PATH = data('text_ascii2')
def test_no_differences():
difference = compare_directories(os.path.dirname(__file__), os.path.dirname(__file__))
assert difference is None
def test_no_differences_with_extra_slash():
difference = compare_directories(os.path.dirname(__file__) + '/', os.path.dirname(__file__))
assert difference is None
@pytest.fixture
def differences(tmpdir):
tmpdir.mkdir('a')
......@@ -56,12 +59,14 @@ def differences(tmpdir):
os.utime(str(tmpdir.join('b')), (0, 0))
return compare_directories(str(tmpdir.join('a')), str(tmpdir.join('b'))).details
def test_content(differences):
assert differences[0].source1 == 'dir'
assert differences[0].details[0].source1 == 'text'
expected_diff = get_data('text_ascii_expected_diff')
assert differences[0].details[0].unified_diff == expected_diff
def test_stat(differences):
assert 'stat' in differences[0].details[0].details[0].source1
......@@ -77,12 +82,14 @@ def test_compare_to_file(tmpdir):
assert a.compare(b).unified_diff == get_data('test_directory_file_diff')
def test_compare_to_device(tmpdir):
a = specialize(FilesystemFile(str(tmpdir.mkdir('dir'))))
b = specialize(FilesystemFile('/dev/null'))
assert a.compare(b).unified_diff == get_data('test_directory_device_diff')
def test_compare_to_symlink(tmpdir):
path = str(tmpdir.join('src'))
os.symlink('/etc/passwd', path)
......@@ -92,6 +99,7 @@ def test_compare_to_symlink(tmpdir):
assert a.compare(b).unified_diff == get_data('test_directory_symlink_diff')
def test_compare_to_dangling_symlink(tmpdir):
path = str(tmpdir.join('src'))
os.symlink('/dangling', path)
......
......@@ -33,26 +33,32 @@ dtb1 = load_fixture('devicetree1.dtb')
# Generated by: dtc --in-format=dts --out-format=dtb --out=devicetree2.dtb devicetree2.dts
dtb2 = load_fixture('devicetree2.dtb')
def fdtdump_version():
out = subprocess.check_output(('fdtdump', '--version'), stderr=subprocess.STDOUT)
return out.decode().split()[2]
def test_identification(dtb1):
assert isinstance(dtb1, DeviceTreeFile)
def test_no_differences(dtb1):
difference = dtb1.compare(dtb1)
assert difference is None
@pytest.fixture
def differences(dtb1, dtb2):
return dtb1.compare(dtb2).details
@skip_unless_tool_is_at_least('fdtdump', fdtdump_version, '1.4.2')
def test_diff(differences):
expected_diff = get_data('devicetree_expected_diff')
assert differences[0].unified_diff == expected_diff
@skip_unless_tools_exist('fdtdump')
def test_compare_non_existing(monkeypatch, dtb1):
monkeypatch.setattr(Config(), 'new_file', True)
......
......@@ -34,17 +34,21 @@ from ..utils.tools import skip_unless_tools_exist, \
obj1 = load_fixture('test1.o')
obj2 = load_fixture('test2.o')
def test_obj_identification(obj1):
assert isinstance(obj1, ElfFile)
def test_obj_no_differences(obj1):
difference = obj1.compare(obj1)
assert difference is None
@pytest.fixture
def obj_differences(obj1, obj2):
return obj1.compare(obj2).details
@skip_unless_tools_exist('readelf')
@skip_if_binutils_does_not_support_x86()
def test_obj_compare_non_existing(monkeypatch, obj1):
......@@ -53,6 +57,7 @@ def test_obj_compare_non_existing(monkeypatch, obj1):
assert difference.source2 == '/nonexisting'
assert len(difference.details) > 0
@skip_unless_tools_exist('readelf')
@skip_if_binutils_does_not_support_x86()
def test_diff(obj_differences):
......@@ -64,25 +69,31 @@ def test_diff(obj_differences):
TEST_LIB1_PATH = data('test1.a')
TEST_LIB2_PATH = data('test2.a')
@pytest.fixture
def lib1():
return specialize(FilesystemFile(TEST_LIB1_PATH))
@pytest.fixture
def lib2():
return specialize(FilesystemFile(TEST_LIB2_PATH))
def test_lib_identification(lib1):
assert isinstance(lib1, StaticLibFile)
def test_lib_no_differences(lib1):
difference = lib1.compare(lib1)
assert difference is None
@pytest.fixture
def lib_differences(lib1, lib2):
return lib1.compare(lib2).details
@skip_unless_tools_exist('readelf',