Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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)
def lib1():
return specialize(FilesystemFile(TEST_LIB1_PATH))
def lib2():
return specialize(FilesystemFile(TEST_LIB2_PATH))
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)
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))
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'))