Commit 1065b642 authored by Chris Lamb's avatar Chris Lamb 💬

Rename skip_unless_tool_exists -> skip_unless_tools_exist and fix logic.

I misread the inverted logic of "skipIf(not tool_exists(x) or not tool_exists(y))".
Signed-off-by: Chris Lamb's avatarChris Lamb <lamby@debian.org>
parent 7d8d8ea6
......@@ -27,7 +27,7 @@ from diffoscope.exc import RequiredToolNotFound
from diffoscope.difference import Difference
from diffoscope.comparators.binary import File, FilesystemFile, NonExistingFile
from utils import skip_unless_tool_exists, data, load_fixture
from utils import skip_unless_tools_exist, data, load_fixture
TEST_FILE1_PATH = data('binary1')
TEST_FILE2_PATH = data('binary2')
......@@ -64,7 +64,7 @@ def test_no_differences_with_xxd(binary1):
difference = binary1.compare_bytes(binary1)
assert difference is None
@skip_unless_tool_exists('xxd')
@skip_unless_tools_exist('xxd')
def test_compare_with_xxd(binary1, binary2):
difference = binary1.compare_bytes(binary2)
expected_diff = open(data('binary_expected_diff')).read()
......@@ -97,7 +97,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_tool_exists('xxd')
@skip_unless_tools_exist('xxd')
def test_with_compare_details_and_fallback():
class MockFile(FilesystemFile):
def compare_details(self, other, source=None):
......@@ -114,7 +114,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_tool_exists('xxd')
@skip_unless_tools_exist('xxd')
def test_with_compare_details_and_failed_process():
output = 'Free Jeremy Hammond'
class MockFile(FilesystemFile):
......@@ -127,7 +127,7 @@ def test_with_compare_details_and_failed_process():
assert '42' in difference.comment
assert difference.unified_diff == expected_diff
@skip_unless_tool_exists('xxd')
@skip_unless_tools_exist('xxd')
def test_with_compare_details_and_tool_not_found(monkeypatch):
monkeypatch.setattr('diffoscope.exc.RequiredToolNotFound.get_package', lambda _: 'some-package')
class MockFile(FilesystemFile):
......
......@@ -24,7 +24,7 @@ from diffoscope.comparators import specialize
from diffoscope.comparators.bzip2 import Bzip2File
from diffoscope.comparators.binary import FilesystemFile
from utils import skip_unless_tool_exists, data, load_fixture, \
from utils import skip_unless_tools_exist, data, load_fixture, \
assert_non_existing
......@@ -45,12 +45,12 @@ def test_no_differences(bzip1):
def differences(bzip1, bzip2):
return bzip1.compare(bzip2).details
@skip_unless_tool_exists('bzip2')
@skip_unless_tools_exist('bzip2')
def test_content_source(differences):
assert differences[0].source1 == 'test1'
assert differences[0].source2 == 'test2'
@skip_unless_tool_exists('bzip2')
@skip_unless_tools_exist('bzip2')
def test_content_source_without_extension(tmpdir):
path1 = str(tmpdir.join('test1'))
path2 = str(tmpdir.join('test2'))
......@@ -62,11 +62,11 @@ def test_content_source_without_extension(tmpdir):
assert differences[0].source1 == 'test1-content'
assert differences[0].source2 == 'test2-content'
@skip_unless_tool_exists('bzip2')
@skip_unless_tools_exist('bzip2')
def test_content_diff(differences):
expected_diff = open(data('text_ascii_expected_diff')).read()
assert differences[0].unified_diff == expected_diff
@skip_unless_tool_exists('bzip2')
@skip_unless_tools_exist('bzip2')
def test_compare_non_existing(monkeypatch, bzip1):
assert_non_existing(monkeypatch, bzip1)
......@@ -26,7 +26,7 @@ from diffoscope.presenters.text import output_text
from diffoscope.comparators.cbfs import CbfsFile
from diffoscope.comparators.binary import FilesystemFile
from utils import skip_unless_tool_exists, data, assert_non_existing
from utils import skip_unless_tools_exist, data, assert_non_existing
TEST_FILE1_PATH = data('text_ascii1')
TEST_FILE2_PATH = data('text_ascii2')
......@@ -54,15 +54,15 @@ def rom2(tmpdir):
f.write(buf[:-4])
return specialize(FilesystemFile(path))
@skip_unless_tool_exists('cbfstool')
@skip_unless_tools_exist('cbfstool')
def test_identification_using_offset(rom1):
assert isinstance(rom1, CbfsFile)
@skip_unless_tool_exists('cbfstool')
@skip_unless_tools_exist('cbfstool')
def test_identification_without_offset(rom2):
assert isinstance(rom2, CbfsFile)
@skip_unless_tool_exists('cbfstool')
@skip_unless_tools_exist('cbfstool')
def test_no_differences(rom1):
difference = rom1.compare(rom1)
assert difference is None
......@@ -73,18 +73,18 @@ def differences(rom1, rom2):
output_text(difference, print_func=print)
return difference.details
@skip_unless_tool_exists('cbfstool')
@skip_unless_tools_exist('cbfstool')
def test_listing(differences):
expected_diff = open(data('cbfs_listing_expected_diff')).read()
assert differences[0].unified_diff == expected_diff
@skip_unless_tool_exists('cbfstool')
@skip_unless_tools_exist('cbfstool')
def test_content(differences):
assert differences[1].source1 == 'text'
assert differences[1].source2 == 'text'
expected_diff = open(data('text_ascii_expected_diff')).read()
assert differences[1].unified_diff == expected_diff
@skip_unless_tool_exists('cbfstool')
@skip_unless_tools_exist('cbfstool')
def test_compare_non_existing(monkeypatch, rom1):
assert_non_existing(monkeypatch, rom1)
......@@ -21,7 +21,7 @@ import pytest
from diffoscope.comparators.cpio import CpioFile
from utils import skip_unless_tool_exists, data, load_fixture, \
from utils import skip_unless_tools_exist, data, load_fixture, \
assert_non_existing
......@@ -39,25 +39,25 @@ def test_no_differences(cpio1):
def differences(cpio1, cpio2):
return cpio1.compare(cpio2).details
@skip_unless_tool_exists('cpio')
@skip_unless_tools_exist('cpio')
def test_listing(differences):
expected_diff = open(data('cpio_listing_expected_diff')).read()
assert differences[0].unified_diff == expected_diff
@skip_unless_tool_exists('cpio')
@skip_unless_tools_exist('cpio')
def test_symlink(differences):
assert differences[1].source1 == 'dir/link'
assert differences[1].comment == 'symlink'
expected_diff = open(data('symlink_expected_diff')).read()
assert differences[1].unified_diff == expected_diff
@skip_unless_tool_exists('cpio')
@skip_unless_tools_exist('cpio')
def test_compressed_files(differences):
assert differences[2].source1 == 'dir/text'
assert differences[2].source2 == 'dir/text'
expected_diff = open(data('text_ascii_expected_diff')).read()
assert differences[2].unified_diff == expected_diff
@skip_unless_tool_exists('cpio')
@skip_unless_tools_exist('cpio')
def test_compare_non_existing(monkeypatch, cpio1):
assert_non_existing(monkeypatch, cpio1)
......@@ -23,7 +23,7 @@ from diffoscope.config import Config
from diffoscope.comparators.dex import DexFile
from diffoscope.comparators.binary import NonExistingFile
from utils import skip_unless_tool_exists, data, load_fixture
from utils import skip_unless_tools_exist, data, load_fixture
dex1 = load_fixture(data('test1.dex'))
......@@ -40,9 +40,7 @@ def test_no_differences(dex1):
def differences(dex1, dex2):
return dex1.compare(dex2).details
@skip_unless_tool_exists('enjarify')
@skip_unless_tool_exists('zipinfo')
@skip_unless_tool_exists('javap')
@skip_unless_tools_exist('enjarify', 'zipinfo', 'javap')
def test_differences(differences):
assert differences[0].source1 == 'test1.jar'
assert differences[0].source2 == 'test2.jar'
......@@ -56,9 +54,7 @@ def test_differences(differences):
found_diff = zipinfo.unified_diff + classdiff.details[0].unified_diff
assert expected_diff == found_diff
@skip_unless_tool_exists('enjarify')
@skip_unless_tool_exists('zipinfo')
@skip_unless_tool_exists('javap')
@skip_unless_tools_exist('enjarify', 'zipinfo', 'javap')
def test_compare_non_existing(monkeypatch, dex1):
monkeypatch.setattr(Config.general, 'new_file', True)
difference = dex1.compare(NonExistingFile('/nonexisting', dex1))
......
......@@ -27,7 +27,7 @@ from diffoscope.comparators.elf import ElfFile, StaticLibFile
from diffoscope.comparators.binary import FilesystemFile, NonExistingFile
from diffoscope.comparators.directory import FilesystemDirectory
from utils import skip_unless_tool_exists, data, load_fixture
from utils import skip_unless_tools_exist, data, load_fixture
try:
import diffoscope.comparators.debian # noqa
......@@ -49,14 +49,14 @@ def test_obj_no_differences(obj1):
def obj_differences(obj1, obj2):
return obj1.compare(obj2).details
@skip_unless_tool_exists('readelf')
@skip_unless_tools_exist('readelf')
def test_obj_compare_non_existing(monkeypatch, obj1):
monkeypatch.setattr(Config, 'new_file', True)
difference = obj1.compare(NonExistingFile('/nonexisting', obj1))
assert difference.source2 == '/nonexisting'
assert len(difference.details) > 0
@skip_unless_tool_exists('readelf')
@skip_unless_tools_exist('readelf')
def test_diff(obj_differences):
assert len(obj_differences) == 1
expected_diff = open(data('elf_obj_expected_diff')).read()
......@@ -84,7 +84,7 @@ def test_lib_no_differences(lib1):
def lib_differences(lib1, lib2):
return lib1.compare(lib2).details
@skip_unless_tool_exists('readelf', 'objdump')
@skip_unless_tools_exist('readelf', 'objdump')
def test_lib_differences(lib_differences):
assert len(lib_differences) == 2
assert lib_differences[0].source1 == 'file list'
......@@ -94,7 +94,7 @@ def test_lib_differences(lib_differences):
expected_objdump_diff = open(data('elf_lib_objdump_expected_diff')).read()
assert lib_differences[1].unified_diff == expected_objdump_diff
@skip_unless_tool_exists('readelf', 'objdump')
@skip_unless_tools_exist('readelf', 'objdump')
def test_lib_compare_non_existing(monkeypatch, lib1):
monkeypatch.setattr(Config, 'new_file', True)
difference = lib1.compare(NonExistingFile('/nonexisting', lib1))
......@@ -118,7 +118,7 @@ def dbgsym_dir2():
def dbgsym_differences(dbgsym_dir1, dbgsym_dir2):
return dbgsym_dir1.compare(dbgsym_dir2)
@skip_unless_tool_exists('readelf', 'objdump', 'objcopy')
@skip_unless_tools_exist('readelf', 'objdump', 'objcopy')
@pytest.mark.skipif(miss_debian_module, reason='debian module is not installed')
def test_differences_with_dbgsym(dbgsym_differences):
output_text(dbgsym_differences, print)
......@@ -128,7 +128,7 @@ def test_differences_with_dbgsym(dbgsym_differences):
assert bin_details.details[1].source1.startswith('objdump')
assert 'test-cases/dbgsym/package/test.c:2' in bin_details.details[1].unified_diff
@skip_unless_tool_exists('readelf', 'objdump', 'objcopy')
@skip_unless_tools_exist('readelf', 'objdump', 'objcopy')
@pytest.mark.skipif(miss_debian_module, reason='debian module is not installed')
def test_original_gnu_debuglink(dbgsym_differences):
bin_details = dbgsym_differences.details[2].details[0].details[0]
......
......@@ -23,7 +23,7 @@ from diffoscope.config import Config
from diffoscope.comparators.zip import ZipFile
from diffoscope.comparators.binary import NonExistingFile
from utils import skip_unless_tool_exists, data, load_fixture
from utils import skip_unless_tools_exist, data, load_fixture
epub1 = load_fixture(data('test1.epub'))
epub2 = load_fixture(data('test2.epub'))
......@@ -39,7 +39,7 @@ def test_no_differences(epub1):
def differences(epub1, epub2):
return epub1.compare(epub2).details
@skip_unless_tool_exists('zipinfo')
@skip_unless_tools_exist('zipinfo')
def test_differences(differences):
assert differences[0].source1 == 'zipinfo {}'
assert differences[0].source2 == 'zipinfo {}'
......@@ -52,7 +52,7 @@ def test_differences(differences):
expected_diff = open(data('epub_expected_diffs')).read()
assert expected_diff == "".join(map(lambda x: x.unified_diff, differences))
@skip_unless_tool_exists('zipinfo')
@skip_unless_tools_exist('zipinfo')
def test_compare_non_existing(monkeypatch, epub1):
monkeypatch.setattr(Config.general, 'new_file', True)
difference = epub1.compare(NonExistingFile('/nonexisting', epub1))
......
......@@ -23,7 +23,7 @@ from diffoscope.config import Config
from diffoscope.comparators.fonts import TtfFile
from diffoscope.comparators.binary import NonExistingFile
from utils import skip_unless_tool_exists, data, load_fixture
from utils import skip_unless_tools_exist, data, load_fixture
ttf1 = load_fixture(data('Samyak-Malayalam1.ttf'))
......@@ -40,12 +40,12 @@ def test_no_differences(ttf1):
def differences(ttf1, ttf2):
return ttf1.compare(ttf2).details
@skip_unless_tool_exists('showttf')
@skip_unless_tools_exist('showttf')
def test_diff(differences):
expected_diff = open(data('ttf_expected_diff')).read()
assert differences[0].unified_diff == expected_diff
@skip_unless_tool_exists('showttf')
@skip_unless_tools_exist('showttf')
def test_compare_non_existing(monkeypatch, ttf1):
monkeypatch.setattr(Config, 'new_file', True)
difference = ttf1.compare(NonExistingFile('/nonexisting', ttf1))
......
......@@ -23,7 +23,7 @@ from diffoscope.config import Config
from diffoscope.comparators.binary import NonExistingFile
from diffoscope.comparators.fsimage import FsImageFile
from utils import skip_unless_tool_exists, data, load_fixture
from utils import skip_unless_tools_exist, data, load_fixture
try:
import guestfs
......@@ -49,7 +49,7 @@ def test_identification(img1):
assert isinstance(img1, FsImageFile)
@pytest.mark.skipif(not guestfs_working(), reason='guestfs not working on the system')
@skip_unless_tool_exists('qemu-img')
@skip_unless_tools_exist('qemu-img')
@pytest.mark.skipif(miss_guestfs, reason='guestfs is missing')
def test_no_differences(img1):
difference = img1.compare(img1)
......@@ -60,7 +60,7 @@ def differences(img1, img2):
return img1.compare(img2).details
@pytest.mark.skipif(not guestfs_working(), reason='guestfs not working on the system')
@skip_unless_tool_exists('qemu-img')
@skip_unless_tools_exist('qemu-img')
@pytest.mark.skipif(miss_guestfs, reason='guestfs is missing')
def test_differences(differences):
assert differences[0].source1 == 'test1.ext4.tar'
......@@ -78,7 +78,7 @@ def test_differences(differences):
assert expected_diff == found_diff
@pytest.mark.skipif(not guestfs_working(), reason='guestfs not working on the system')
@skip_unless_tool_exists('qemu-img')
@skip_unless_tools_exist('qemu-img')
@pytest.mark.skipif(miss_guestfs, reason='guestfs is missing')
def test_compare_non_existing(monkeypatch, img1):
monkeypatch.setattr(Config.general, 'new_file', True)
......
......@@ -24,7 +24,7 @@ from diffoscope.config import Config
from diffoscope.comparators.binary import NonExistingFile
from diffoscope.comparators.gettext import MoFile
from utils import skip_unless_tool_exists, data, load_fixture
from utils import skip_unless_tools_exist, data, load_fixture
mo1 = load_fixture(data('test1.mo'))
mo2 = load_fixture(data('test2.mo'))
......@@ -40,7 +40,7 @@ def test_no_differences(mo1):
def differences(mo1, mo2):
return mo1.compare(mo2).details
@skip_unless_tool_exists('msgunfmt')
@skip_unless_tools_exist('msgunfmt')
def test_diff(differences):
expected_diff = open(data('mo_expected_diff')).read()
assert differences[0].unified_diff == expected_diff
......@@ -48,13 +48,13 @@ def test_diff(differences):
mo_no_charset = load_fixture(data('test_no_charset.mo'))
mo_iso8859_1 = load_fixture(data('test_iso8859-1.mo'))
@skip_unless_tool_exists('msgunfmt')
@skip_unless_tools_exist('msgunfmt')
def test_charsets(mo_no_charset, mo_iso8859_1):
difference = mo_no_charset.compare(mo_iso8859_1)
expected_diff = codecs.open(data('mo_charsets_expected_diff'), encoding='utf-8').read()
assert difference.details[0].unified_diff == expected_diff
@skip_unless_tool_exists('msgunfmt')
@skip_unless_tools_exist('msgunfmt')
def test_compare_non_existing(monkeypatch, mo1):
monkeypatch.setattr(Config, 'new_file', True)
difference = mo1.compare(NonExistingFile('/nonexisting', mo1))
......
......@@ -21,12 +21,12 @@ import pytest
from diffoscope.comparators.haskell import HiFile
from utils import skip_unless_tool_exists, data, load_fixture
from utils import skip_unless_tools_exist, data, load_fixture
haskell1 = load_fixture(data('test1.hi'))
haskell2 = load_fixture(data('test2.hi'))
@skip_unless_tool_exists('ghc')
@skip_unless_tools_exist('ghc')
def test_identification(haskell1):
assert isinstance(haskell1, HiFile)
......@@ -37,7 +37,7 @@ def test_no_differences(haskell1):
def differences(haskell1, haskell2):
return haskell1.compare(haskell2).details
@skip_unless_tool_exists('ghc')
@skip_unless_tools_exist('ghc')
def test_diff(differences):
with open(data('haskell_expected_diff')) as f:
expected_diff = f.read()
......
......@@ -23,7 +23,7 @@ from diffoscope.config import Config
from diffoscope.comparators.icc import IccFile
from diffoscope.comparators.binary import NonExistingFile
from utils import skip_unless_tool_exists, data, load_fixture
from utils import skip_unless_tools_exist, data, load_fixture
icc1 = load_fixture(data('test1.icc'))
icc2 = load_fixture(data('test2.icc'))
......@@ -39,12 +39,12 @@ def test_no_differences(icc1):
def differences(icc1, icc2):
return icc1.compare(icc2).details
@skip_unless_tool_exists('cd-iccdump')
@skip_unless_tools_exist('cd-iccdump')
def test_diff(differences):
expected_diff = open(data('icc_expected_diff')).read()
assert differences[0].unified_diff == expected_diff
@skip_unless_tool_exists('cd-iccdump')
@skip_unless_tools_exist('cd-iccdump')
def test_compare_non_existing(monkeypatch, icc1):
monkeypatch.setattr(Config, 'new_file', True)
difference = icc1.compare(NonExistingFile('/nonexisting', icc1))
......
......@@ -23,7 +23,7 @@ from diffoscope.config import Config
from diffoscope.comparators.image import ImageFile
from diffoscope.comparators.binary import NonExistingFile
from utils import skip_unless_tool_exists, data, load_fixture
from utils import skip_unless_tools_exist, data, load_fixture
image1 = load_fixture(data('test1.jpg'))
image2 = load_fixture(data('test2.jpg'))
......@@ -39,12 +39,12 @@ def test_no_differences(image1):
def differences(image1, image2):
return image1.compare(image2).details
@skip_unless_tool_exists('img2txt')
@skip_unless_tools_exist('img2txt')
def test_diff(differences):
expected_diff = open(data('image_expected_diff')).read()
assert differences[0].unified_diff == expected_diff
@skip_unless_tool_exists('img2txt')
@skip_unless_tools_exist('img2txt')
def test_compare_non_existing(monkeypatch, image1):
monkeypatch.setattr(Config, 'new_file', True)
difference = image1.compare(NonExistingFile('/nonexisting', image1))
......
......@@ -23,7 +23,7 @@ from diffoscope.config import Config
from diffoscope.comparators.binary import NonExistingFile
from diffoscope.comparators.iso9660 import Iso9660File
from utils import skip_unless_tool_exists, data, load_fixture
from utils import skip_unless_tools_exist, data, load_fixture
iso1 = load_fixture(data('test1.iso'))
iso2 = load_fixture(data('test2.iso'))
......@@ -39,30 +39,30 @@ def test_no_differences(iso1):
def differences(iso1, iso2):
return iso1.compare(iso2).details
@skip_unless_tool_exists('isoinfo')
@skip_unless_tools_exist('isoinfo')
def test_iso9660_content(differences):
expected_diff = open(data('iso9660_content_expected_diff')).read()
assert differences[0].unified_diff == expected_diff
@skip_unless_tool_exists('isoinfo')
@skip_unless_tools_exist('isoinfo')
def test_iso9660_rockridge(differences):
expected_diff = open(data('iso9660_rockridge_expected_diff')).read()
assert differences[1].unified_diff == expected_diff
@skip_unless_tool_exists('isoinfo')
@skip_unless_tools_exist('isoinfo')
def test_symlink(differences):
assert differences[3].comment == 'symlink'
expected_diff = open(data('symlink_expected_diff')).read()
assert differences[3].unified_diff == expected_diff
@skip_unless_tool_exists('isoinfo')
@skip_unless_tools_exist('isoinfo')
def test_compressed_files(differences):
assert differences[2].source1 == 'text'
assert differences[2].source2 == 'text'
expected_diff = open(data('text_ascii_expected_diff')).read()
assert differences[2].unified_diff == expected_diff
@skip_unless_tool_exists('isoinfo')
@skip_unless_tools_exist('isoinfo')
def test_compare_non_existing(monkeypatch, iso1):
monkeypatch.setattr(Config.general, 'new_file', True)
difference = iso1.compare(NonExistingFile('/nonexisting', iso1))
......
......@@ -23,7 +23,7 @@ from diffoscope.config import Config
from diffoscope.comparators.java import ClassFile
from diffoscope.comparators.binary import NonExistingFile
from utils import skip_unless_tool_exists, data, load_fixture
from utils import skip_unless_tools_exist, data, load_fixture
class1 = load_fixture(data('Test1.class'))
class2 = load_fixture(data('Test2.class'))
......@@ -39,12 +39,12 @@ def test_no_differences(class1):
def differences(class1, class2):
return class1.compare(class2).details
@skip_unless_tool_exists('javap')
@skip_unless_tools_exist('javap')
def test_diff(differences):
expected_diff = open(data('class_expected_diff')).read()
assert differences[0].unified_diff == expected_diff
@skip_unless_tool_exists('javap')
@skip_unless_tools_exist('javap')
def test_compare_non_existing(monkeypatch, class1):
monkeypatch.setattr(Config, 'new_file', True)
difference = class1.compare(NonExistingFile('/nonexisting', class1))
......
......@@ -25,7 +25,7 @@ from diffoscope.config import Config
from diffoscope.comparators.macho import MachoFile
from diffoscope.comparators.binary import NonExistingFile
from utils import skip_unless_tool_exists, data, load_fixture
from utils import skip_unless_tools_exist, data, load_fixture
obj1 = load_fixture(data('test1.macho'))
obj2 = load_fixture(data('test2.macho'))
......@@ -41,14 +41,14 @@ def test_obj_no_differences(obj1):
def obj_differences(obj1, obj2):
return obj1.compare(obj2).details
@skip_unless_tool_exists('otool', 'lipo')
@skip_unless_tools_exist('otool', 'lipo')
def test_obj_compare_non_existing(monkeypatch, obj1):
monkeypatch.setattr(Config, 'new_file', True)
difference = obj1.compare(NonExistingFile('/nonexisting', obj1))
assert difference.source2 == '/nonexisting'
assert len(difference.details) > 0
@skip_unless_tool_exists('otool', 'lipo')
@skip_unless_tools_exist('otool', 'lipo')
def test_diff(obj_differences):
assert len(obj_differences) == 4
l = ['macho_expected_diff_arch', 'macho_expected_diff_headers', 'macho_expected_diff_loadcommands', 'macho_expected_diff_disassembly']
......
......@@ -23,7 +23,7 @@ from diffoscope.config import Config
from diffoscope.comparators.mono import MonoExeFile
from diffoscope.comparators.binary import NonExistingFile
from utils import skip_unless_tool_exists, data, load_fixture
from utils import skip_unless_tools_exist, data, load_fixture
# these were generated with:
......@@ -44,12 +44,12 @@ def test_no_differences(exe1):
def differences(exe1, exe2):
return exe1.compare(exe2).details
@skip_unless_tool_exists('pedump')
@skip_unless_tools_exist('pedump')
def test_diff(differences):
expected_diff = open(data('pe_expected_diff')).read()
assert differences[0].unified_diff == expected_diff
@skip_unless_tool_exists('pedump')
@skip_unless_tools_exist('pedump')
def test_compare_non_existing(monkeypatch, exe1):
monkeypatch.setattr(Config, 'new_file', True)
difference = exe1.compare(NonExistingFile('/nonexisting', exe1))
......
......@@ -21,7 +21,7 @@ import pytest
from diffoscope.comparators.pdf import PdfFile
from utils import skip_unless_tool_exists, data, load_fixture, \
from utils import skip_unless_tools_exist, data, load_fixture, \
assert_non_existing
pdf1 = load_fixture(data('test1.pdf'))
......@@ -38,16 +38,16 @@ def test_no_differences(pdf1):
def differences(pdf1, pdf2):
return pdf1.compare(pdf2).details
@skip_unless_tool_exists('pdftk', 'pdftotext')
@skip_unless_tools_exist('pdftk', 'pdftotext')
def test_text_diff(differences):
expected_diff = open(data('pdf_text_expected_diff')).read()
assert differences[0].unified_diff == expected_diff
@skip_unless_tool_exists('pdftk', 'pdftotext')
@skip_unless_tools_exist('pdftk', 'pdftotext')
def test_internal_diff(differences):
expected_diff = open(data('pdf_internal_expected_diff')).read()
assert differences[1].unified_diff == expected_diff
@skip_unless_tool_exists('pdftk', 'pdftotext')
@skip_unless_tools_exist('pdftk', 'pdftotext')
def test_compare_non_existing(monkeypatch, pdf1):
assert_non_existing(monkeypatch, pdf1, has_null_source=False)
......@@ -21,7 +21,7 @@ import pytest
from diffoscope.comparators.png import PngFile
from utils import skip_unless_tool_exists, data, load_fixture, \
from utils import skip_unless_tools_exist, data, load_fixture, \
assert_non_existing
png1 = load_fixture(data('test1.png'))
......@@ -38,11 +38,11 @@ def test_no_differences(png1):
def differences(png1, png2):
return png1.compare(png2).details
@skip_unless_tool_exists('sng')
@skip_unless_tools_exist('sng')
def test_diff(differences):
expected_diff = open(data('png_expected_diff')).read()
assert differences[0].unified_diff == expected_diff
@skip_unless_tool_exists('sng')
@skip_unless_tools_exist('sng')
def test_compare_non_existing(monkeypatch, png1):
assert_non_existing(monkeypatch, png1, has_null_source=False)
......@@ -22,7 +22,7 @@ import pytest
from diffoscope.comparators.ppu import PpuFile
from utils import skip_unless_tool_exists, data, load_fixture, \
from utils import skip_unless_tools_exist, data, load_fixture, \
assert_non_existing
# These test files were taken from two different builds of the Debian package
......@@ -34,7 +34,7 @@ from utils import skip_unless_tool_exists, data, load_fixture, \
file1 = load_fixture(data('test1.ppu'))
file2 = load_fixture(data('test2.ppu'))
@skip_unless_tool_exists('ppudump')
@skip_unless_tools_exist('ppudump')
def test_identification(file1):
assert isinstance(file1, PpuFile)
......@@ -46,12 +46,12 @@ def test_no_differences(file1):
def differences(file1, file2):
return file1.compare(file2).details
@skip_unless_tool_exists('ppudump')
@skip_unless_tools_exist('ppudump')
def test_diff(differences):
print(differences[0].unified_diff)
expected_diff = open(data('ppu_expected_diff')).read()
assert differences[0].unified_diff == expected_diff
@skip_unless_tool_exists('ppudump')
@skip_unless_tools_exist('ppudump')
def test_compare_non_existing(monkeypatch, file1):
assert_non_existing(monkeypatch, file1, has_null_source=False)
......@@ -21,7 +21,7 @@ import pytest
from diffoscope.comparators.ps import PsFile
from utils import skip_unless_tool_exists, data, load_fixture, \
from utils import skip_unless_tools_exist, data, load_fixture, \
assert_non_existing
ps1 = load_fixture(data('test1.ps'))
......@@ -38,16 +38,16 @@ def test_no_differences(ps1):
def differences(ps1, ps2):
return ps1.compare(ps2)
@skip_unless_tool_exists('ps2ascii')
@skip_unless_tools_exist('ps2ascii')
def test_internal_diff(differences):
expected_diff = open(data('ps_internal_expected_diff')).read()
assert differences.unified_diff == expected_diff
@skip_unless_tool_exists('ps2ascii')
@skip_unless_tools_exist('ps2ascii')
def test_text_diff(differences):
expected_diff = open(data('ps_text_expected_diff')).read()
assert differences.details[0].unified_diff == expected_diff
@skip_unless_tool_exists('ps2ascii')
@skip_unless_tools_exist('ps2ascii')
def test_compare_non_existing(monkeypatch, ps1):
assert_non_existing(monkeypatch, ps1, has_null_source=False)
......@@ -23,7 +23,7 @@ import pytest
from diffoscope.comparators.ar import ArFile
from diffoscope.comparators.utils import diff_ignore_line_numbers
from utils import skip_unless_tool_exists, tool_older_than, data, \
from utils import skip_unless_tools_exist, tool_older_than, data, \
load_fixture, assert_non_existing
rlib1 = load_fixture(data('test1.rlib'))
......@@ -59,7 +59,7 @@ def test_item2_rust_metadata_bin(differences):
assert differences[2].source1 == 'rust.metadata.bin'
assert differences[2].source2 == 'rust.metadata.bin'
@skip_unless_tool_exists('llvm-dis')
@skip_unless_tools_exist('llvm-dis')
@pytest.mark.skipif(tool_older_than(['llvm-config', '--version'], '3.8'), reason='llvm version too low')
def test_item3_deflate_llvm_bitcode(differences):
assert differences[3].source1 == 'alloc_system-d16b8f0e.0.bytecode.deflate'
......
......@@ -19,7 +19,7 @@
import pytest
from utils import skip_unless_tool_exists, data, load_fixture, \
from utils import skip_unless_tools_exist, data, load_fixture, \
assert_non_existing