How to use the diffoscope.comparators.utils.specialize.specialize function in diffoscope

To help you get started, we’ve selected a few diffoscope examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github anthraxx / diffoscope / tests / comparators / test_rpm.py View on Github external
def test_fallback_comparison(monkeypatch):
    manager = ComparatorManager()
    monkeypatch.setattr(manager, 'COMPARATORS', (
        ('rpm_fallback.RpmFile',),
    ))
    manager.reload()

    # Re-specialize after reloading our Comparators
    rpm1 = specialize(FilesystemFile(data('test1.rpm')))
    rpm2 = specialize(FilesystemFile(data('test2.rpm')))

    assert rpm1.compare(rpm1) is None
    assert rpm2.compare(rpm2) is None

    expected_diff = get_data('rpm_fallback_expected_diff')
    assert normalize_zeros(rpm1.compare(rpm2).unified_diff) == expected_diff
github anthraxx / diffoscope / tests / comparators / test_debian.py View on Github external
def test_dot_buildinfo_invalid(tmpdir):
    tmpdir.mkdir('a')
    dot_buildinfo_path = str(tmpdir.join('a/test_1.buildinfo'))
    shutil.copy(TEST_DOT_BUILDINFO_FILE1_PATH, dot_buildinfo_path)
    # we don't copy the referenced .deb
    identified = specialize(FilesystemFile(dot_buildinfo_path))
    assert not isinstance(identified, DotBuildinfoFile)
github anthraxx / diffoscope / tests / comparators / test_elf.py View on Github external
def lib1():
    return specialize(FilesystemFile(TEST_LIB1_PATH))
github anthraxx / diffoscope / tests / comparators / test_elf.py View on Github external
def lib2():
    return specialize(FilesystemFile(TEST_LIB2_PATH))
github anthraxx / diffoscope / tests / comparators / test_debian.py View on Github external
def test_dot_changes_invalid(tmpdir):
    tmpdir.mkdir('a')
    dot_changes_path = str(tmpdir.join('a/test_1.changes'))
    shutil.copy(TEST_DOT_CHANGES_FILE1_PATH, dot_changes_path)
    # we don't copy the referenced .deb
    identified = specialize(FilesystemFile(dot_changes_path))
    assert not isinstance(identified, DotChangesFile)
github anthraxx / diffoscope / tests / comparators / test_debian.py View on Github external
def dot_changes2(tmpdir):
    tmpdir.mkdir('b')
    dot_changes_path = str(tmpdir.join('b/test_1.changes'))
    shutil.copy(TEST_DOT_CHANGES_FILE2_PATH, dot_changes_path)
    shutil.copy(TEST_DEB_FILE2_PATH, str(tmpdir.join('b/test_1_all.deb')))
    shutil.copy(TEST_DOT_BUILDINFO_FILE2_PATH, str(tmpdir.join('b/test_2.buildinfo')))
    return specialize(FilesystemFile(dot_changes_path))
github anthraxx / diffoscope / diffoscope / comparators / deb.py View on Github external
def control_tar(self):
        for name, member in self.get_members().items():
            if DebContainer.RE_CONTROL_TAR.match(name):
                specialize(member)
                if name.endswith('.tar'):
                    return member
                else:
                    return specialize(member.as_container.get_member('content'))