How to use the diffoscope.comparators.missing_file.MissingFile 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_gettext.py View on Github external
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
github anthraxx / diffoscope / tests / comparators / test_fonts.py View on Github external
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
github anthraxx / diffoscope / tests / comparators / test_java.py View on Github external
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
github anthraxx / diffoscope / tests / comparators / test_iso9660.py View on Github external
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'
github anthraxx / diffoscope / tests / comparators / test_ipk.py View on Github external
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'
github anthraxx / diffoscope / tests / comparators / test_mono.py View on Github external
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
github anthraxx / diffoscope / tests / comparators / test_elf.py View on Github external
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
github anthraxx / diffoscope / diffoscope / comparators / utils / compare.py View on Github external
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)
github anthraxx / diffoscope / diffoscope / comparators / utils / archive.py View on Github external
def __new__(cls, source, *args, **kwargs):
        if isinstance(source, MissingFile):
            return super(Container, MissingArchive).__new__(MissingArchive)
        else:
            return super(Container, cls).__new__(cls)
github anthraxx / diffoscope / diffoscope / comparators / utils / container.py View on Github external
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)