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_compare_non_existing(monkeypatch, mo1):
monkeypatch.setattr(Config(), 'new_file', True)
difference = mo1.compare(MissingFile('/nonexisting', mo1))
assert difference.source2 == '/nonexisting'
assert len(difference.details) > 0
def test_compare_non_existing(monkeypatch, ttf1):
monkeypatch.setattr(Config(), 'new_file', True)
difference = ttf1.compare(MissingFile('/nonexisting', ttf1))
assert difference.source2 == '/nonexisting'
assert len(difference.details) > 0
def test_compare_non_existing(monkeypatch, class1):
monkeypatch.setattr(Config(), 'new_file', True)
difference = class1.compare(MissingFile('/nonexisting', class1))
assert difference.source2 == '/nonexisting'
assert len(difference.details) > 0
def test_compare_non_existing(monkeypatch, iso1):
monkeypatch.setattr(Config(), 'new_file', True)
difference = iso1.compare(MissingFile('/nonexisting', iso1))
assert difference.source2 == '/nonexisting'
assert difference.details[-1].source2 == '/dev/null'
def test_compare_non_existing(monkeypatch, ipk1):
monkeypatch.setattr(Config(), 'new_file', True)
difference = ipk1.compare(MissingFile('/nonexisting', ipk1))
assert difference.source2 == '/nonexisting'
assert difference.details[-1].source2 == '/dev/null'
def test_compare_non_existing(monkeypatch, exe1):
monkeypatch.setattr(Config(), 'new_file', True)
difference = exe1.compare(MissingFile('/nonexisting', exe1))
assert difference.source2 == '/nonexisting'
assert len(difference.details) > 0
def test_obj_compare_non_existing(monkeypatch, obj1):
monkeypatch.setattr(Config(), 'new_file', True)
difference = obj1.compare(MissingFile('/nonexisting', obj1))
assert difference.source2 == '/nonexisting'
assert len(difference.details) > 0
file2.name,
file2.__class__.__name__,
)
if any_excluded(file1.name, file2.name):
return None
with profile('has_same_content_as', file1):
if file1.has_same_content_as(file2):
logger.debug("has_same_content_as returned True; skipping further comparisons")
return None
specialize(file1)
specialize(file2)
if isinstance(file1, MissingFile):
file1.other_file = file2
elif isinstance(file2, MissingFile):
file2.other_file = file1
elif file1.__class__.__name__ != file2.__class__.__name__:
return file1.compare_bytes(file2, source)
with profile('compare_files (cumulative)', file1):
return file1.compare(file2, source)
def __new__(cls, source, *args, **kwargs):
if isinstance(source, MissingFile):
return super(Container, MissingArchive).__new__(MissingArchive)
else:
return super(Container, cls).__new__(cls)
def __new__(cls, source):
if isinstance(source, MissingFile):
new = super(Container, MissingContainer).__new__(MissingContainer)
new.__init__(source)
return new
return super(Container, cls).__new__(cls)