Пример #1
0
def test_content_source_without_extension(tmpdir):
    path1 = str(tmpdir.join('test1'))
    path2 = str(tmpdir.join('test2'))
    shutil.copy(TEST_FILE1_PATH, path1)
    shutil.copy(TEST_FILE2_PATH, path2)
    gzip1 = specialize(FilesystemFile(path1))
    gzip2 = specialize(FilesystemFile(path2))
    difference = gzip1.compare(gzip2).details
    assert difference[1].source1 == 'test1-content'
    assert difference[1].source2 == 'test2-content'
Пример #2
0
def test_content_source_without_extension(tmpdir):
    path1 = str(tmpdir.join("test1"))
    path2 = str(tmpdir.join("test2"))
    shutil.copy(TEST_FILE1_PATH, path1)
    shutil.copy(TEST_FILE2_PATH, path2)
    bzip1 = specialize(FilesystemFile(path1))
    bzip2 = specialize(FilesystemFile(path2))
    differences = bzip1.compare(bzip2).details
    assert differences[0].source1 == "test1-content"
    assert differences[0].source2 == "test2-content"
Пример #3
0
def test_content_source_without_extension(tmpdir):
    path1 = str(tmpdir.join('test1'))
    path2 = str(tmpdir.join('test2'))
    shutil.copy(TEST_FILE1_PATH, path1)
    shutil.copy(TEST_FILE2_PATH, path2)
    bzip1 = specialize(FilesystemFile(path1))
    bzip2 = specialize(FilesystemFile(path2))
    differences = bzip1.compare(bzip2).details
    assert differences[0].source1 == 'test1-content'
    assert differences[0].source2 == 'test2-content'
Пример #4
0
def test_dot_dsc_invalid(tmpdir, dot_dsc2):
    tmpdir.mkdir('a')
    dot_dsc_path = str(tmpdir.join('a/test_1.dsc'))
    shutil.copy(TEST_DOT_CHANGES_FILE1_PATH, dot_dsc_path)
    # we don't copy the referenced .tar.gz
    identified = specialize(FilesystemFile(dot_dsc_path))
    assert not isinstance(identified, DotDscFile)
Пример #5
0
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)
Пример #6
0
def dot_buildinfo2(tmpdir):
    tmpdir.mkdir('b')
    dot_buildinfo_path = str(tmpdir.join('b/test_1.buildinfo'))
    shutil.copy(TEST_DOT_BUILDINFO_FILE2_PATH, dot_buildinfo_path)
    shutil.copy(TEST_DOT_DSC_FILE2_PATH, str(tmpdir.join('b/test_1.dsc')))
    shutil.copy(TEST_DEB_FILE2_PATH, str(tmpdir.join('b/test_1_all.deb')))
    return specialize(FilesystemFile(dot_buildinfo_path))
Пример #7
0
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)
Пример #8
0
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)
Пример #9
0
def test_dot_dsc_invalid(tmpdir, dot_dsc2):
    tmpdir.mkdir('a')
    dot_dsc_path = str(tmpdir.join('a/test_1.dsc'))
    shutil.copy(TEST_DOT_CHANGES_FILE1_PATH, dot_dsc_path)
    # we don't copy the referenced .tar.gz
    identified = specialize(FilesystemFile(dot_dsc_path))
    assert not isinstance(identified, DotDscFile)
Пример #10
0
def dot_buildinfo2(tmpdir):
    tmpdir.mkdir('b')
    dot_buildinfo_path = str(tmpdir.join('b/test_1.buildinfo'))
    shutil.copy(TEST_DOT_BUILDINFO_FILE2_PATH, dot_buildinfo_path)
    shutil.copy(TEST_DOT_DSC_FILE2_PATH, str(tmpdir.join('b/test_1.dsc')))
    shutil.copy(TEST_DEB_FILE2_PATH, str(tmpdir.join('b/test_1_all.deb')))
    return specialize(FilesystemFile(dot_buildinfo_path))
Пример #11
0
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)
Пример #12
0
def test_difference_between_iso88591_and_unicode_only(iso8859, tmpdir):
    utf8_path = str(tmpdir.join('utf8'))
    with open(utf8_path, 'wb') as f:
        f.write(codecs.open(os.path.join(os.path.dirname(__file__), '../data/text_iso8859'), encoding='iso8859-1').read().encode('utf-8'))
    utf8 = specialize(FilesystemFile(utf8_path))
    difference = iso8859.compare(utf8)
    assert difference.unified_diff is None
    assert difference.details[0].source1 == 'encoding'
Пример #13
0
def rom2(tmpdir):
    path = str(tmpdir.join('coreboot2.rom'))
    size = 32768
    check_call(['cbfstool', path, 'create', '-m', 'x86', '-s', '%s' % size], shell=False)
    check_call(['cbfstool', path, 'add', '-f', TEST_FILE2_PATH, '-n', 'text', '-t', 'raw'], shell=False)
    # Remove the last 4 bytes to exercice the full header search
    buf = bytearray(size)
    with open(path, 'rb') as f:
        f.readinto(buf)
    with open(path, 'wb') as f:
        size = struct.unpack_from('!I', buf, offset=len(buf) - 4 - 32 + 8)[0]
        struct.pack_into('!I', buf, len(buf) - 4 - 32 + 8, size - 4)
        f.write(buf[:-4])
    return specialize(FilesystemFile(path))
Пример #14
0
def image2():
    return specialize(FilesystemFile(TEST_FILE2_PATH))
Пример #15
0
def mozzip2():
    return specialize(FilesystemFile(TEST_MOZZIP2_PATH))
Пример #16
0
def dot_dsc2(tmpdir):
    tmpdir.mkdir('b')
    dot_dsc_path = str(tmpdir.join('b/test_1.dsc'))
    shutil.copy(TEST_DOT_DSC_FILE2_PATH, dot_dsc_path)
    shutil.copy(TEST_DEB_SRC2_PATH, str(tmpdir.join('b/test_1.tar.gz')))
    return specialize(FilesystemFile(dot_dsc_path))
Пример #17
0
def test_identification_of_md5sums_outside_deb(tmpdir):
    path = str(tmpdir.join('md5sums'))
    open(path, 'w')
    f = specialize(FilesystemFile(path))
    assert type(f) is FilesystemFile
Пример #18
0
def dbgsym_dir2():
    container = FilesystemDirectory(os.path.dirname(TEST_DBGSYM_DEB2_PATH)).as_container
    return specialize(FilesystemFile(TEST_DBGSYM_DEB2_PATH, container=container))
Пример #19
0
def mo_iso8859_1():
    return specialize(
        FilesystemFile(
            os.path.join(os.path.dirname(__file__),
                         '../data/test_iso8859-1.mo')))
Пример #20
0
def unicode2():
    return specialize(FilesystemFile(os.path.join(os.path.dirname(__file__), '../data/text_unicode2')))
Пример #21
0
def ascii2():
    return specialize(FilesystemFile(os.path.join(os.path.dirname(__file__), '../data/text_ascii2')))
Пример #22
0
def rom1(tmpdir):
    path = str(tmpdir.join('coreboot1'))
    check_call(['cbfstool', path, 'create', '-m', 'x86', '-s', '32768'], shell=False)
    check_call(['cbfstool', path, 'add', '-f', TEST_FILE1_PATH, '-n', 'text', '-t', 'raw'], shell=False)
    return specialize(FilesystemFile(path))
Пример #23
0
def no_permissions_tar():
    return specialize(FilesystemFile(os.path.join(os.path.dirname(__file__), '../data/no-perms.tar')))
Пример #24
0
def lib2():
    return specialize(FilesystemFile(TEST_LIB2_PATH))
Пример #25
0
def dbgsym_dir2():
    container = FilesystemDirectory(
        os.path.dirname(TEST_DBGSYM_DEB2_PATH)).as_container
    return specialize(
        FilesystemFile(TEST_DBGSYM_DEB2_PATH, container=container))
Пример #26
0
def bzip2():
    return specialize(FilesystemFile(TEST_FILE2_PATH))
Пример #27
0
def iso8859():
    return specialize(FilesystemFile(os.path.join(os.path.dirname(__file__), '../data/text_iso8859')))
Пример #28
0
def fuzzy_tar_in_tar2():
    return specialize(FilesystemFile(os.path.join(os.path.dirname(__file__), '../data/fuzzy-tar-in-tar2.tar')))
Пример #29
0
def binary2():
    return specialize(FilesystemFile(TEST_FILE2_PATH))
Пример #30
0
def mo_iso8859_1():
    return specialize(FilesystemFile(os.path.join(os.path.dirname(__file__), '../data/test_iso8859-1.mo')))
Пример #31
0
def dot_dsc1(tmpdir):
    tmpdir.mkdir("a")
    dot_dsc_path = str(tmpdir.join("a/test_1.dsc"))
    shutil.copy(TEST_DOT_DSC_FILE1_PATH, dot_dsc_path)
    shutil.copy(TEST_DEB_SRC1_PATH, str(tmpdir.join("a/test_1.tar.gz")))
    return specialize(FilesystemFile(dot_dsc_path))
Пример #32
0
def lib2():
    return specialize(FilesystemFile(TEST_LIB2_PATH))
Пример #33
0
def dot_changes1(tmpdir):
    tmpdir.mkdir("a")
    dot_changes_path = str(tmpdir.join("a/test_1.changes"))
    shutil.copy(TEST_DOT_CHANGES_FILE1_PATH, dot_changes_path)
    shutil.copy(TEST_DEB_FILE1_PATH, str(tmpdir.join("a/test_1_all.deb")))
    return specialize(FilesystemFile(dot_changes_path))
Пример #34
0
def squashfs2():
    return specialize(FilesystemFile(TEST_FILE2_PATH))
Пример #35
0
def dot_dsc2(tmpdir):
    tmpdir.mkdir('b')
    dot_dsc_path = str(tmpdir.join('b/test_1.dsc'))
    shutil.copy(TEST_DOT_DSC_FILE2_PATH, dot_dsc_path)
    shutil.copy(TEST_DEB_SRC2_PATH, str(tmpdir.join('b/test_1.tar.gz')))
    return specialize(FilesystemFile(dot_dsc_path))
Пример #36
0
def binary1():
    return specialize(FilesystemFile(TEST_FILE1_PATH))
Пример #37
0
def squashfs2():
    return specialize(FilesystemFile(TEST_FILE2_PATH))
Пример #38
0
def sqlite3db2():
    return specialize(FilesystemFile(TEST_FILE2_PATH))
Пример #39
0
def tar1():
    return specialize(FilesystemFile(TEST_FILE1_PATH))
Пример #40
0
def obj2():
    return specialize(FilesystemFile(TEST_OBJ2_PATH))
Пример #41
0
def test_identification_of_md5sums_outside_deb(tmpdir):
    path = str(tmpdir.join('md5sums'))
    open(path, 'w')
    f = specialize(FilesystemFile(path))
    assert type(f) is FilesystemFile
Пример #42
0
def iso1():
    return specialize(FilesystemFile(TEST_FILE1_PATH))
Пример #43
0
def fuzzy_tar3():
    return specialize(
        FilesystemFile(
            os.path.join(os.path.dirname(__file__), '../data/fuzzy3.tar')))
Пример #44
0
def no_permissions_tar():
    return specialize(
        FilesystemFile(
            os.path.join(os.path.dirname(__file__), '../data/no-perms.tar')))
Пример #45
0
def file2():
    return specialize(FilesystemFile(TEST_FILE2_PATH))
Пример #46
0
def class2():
    return specialize(FilesystemFile(TEST_FILE2_PATH))
Пример #47
0
def mo_no_charset():
    return specialize(
        FilesystemFile(
            os.path.join(os.path.dirname(__file__),
                         '../data/test_no_charset.mo')))
Пример #48
0
def fuzzy_tar_in_tar2():
    return specialize(
        FilesystemFile(
            os.path.join(os.path.dirname(__file__),
                         '../data/fuzzy-tar-in-tar2.tar')))
Пример #49
0
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')))
    return specialize(FilesystemFile(dot_changes_path))
Пример #50
0
def fuzzy_tar3():
    return specialize(FilesystemFile(os.path.join(os.path.dirname(__file__), '../data/fuzzy3.tar')))
Пример #51
0
def mo_no_charset():
    return specialize(FilesystemFile(os.path.join(os.path.dirname(__file__), '../data/test_no_charset.mo')))
Пример #52
0
def obj2():
    return specialize(FilesystemFile(TEST_OBJ2_PATH))
Пример #53
0
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')))
    return specialize(FilesystemFile(dot_changes_path))