Exemplo n.º 1
0
def test_tgz_pack(project, tgz_archive, tmpdir):
    with tarfile.open(name=tgz_archive['name']) as tgz_arch:
        # usr/share/tarantool is added to coorectly run assert_filemodes
        distribution_dir = os.path.join(tmpdir, 'usr/share/tarantool',
                                        project['name'])
        os.makedirs(distribution_dir, exist_ok=True)

        tgz_arch.extractall(path=os.path.join(tmpdir, 'usr/share/tarantool'))
        assert_dir_contents(files_list=recursive_listdir(distribution_dir),
                            exp_files_list=project['distribution_files_list'],
                            exp_rocks_content=project['rocks_content'])

        validate_version_file(project, distribution_dir)
        assert_filemodes(project, tmpdir)
def test_tgz(tgz_archive, tmpdir):
    project = tgz_archive.project

    # archive files should be extracted to the empty directory
    # to correctly check archive contents
    extract_dir = os.path.join(tmpdir, 'extract')
    os.makedirs(extract_dir)

    with tarfile.open(name=tgz_archive.filepath) as tgz_arch:
        # usr/share/tarantool is added to correctly run assert_filemodes
        distribution_dir = os.path.join(extract_dir, 'usr/share/tarantool',
                                        project.name)
        os.makedirs(distribution_dir, exist_ok=True)

        tgz_arch.extractall(
            path=os.path.join(extract_dir, 'usr/share/tarantool'))
        assert_distribution_dir_contents(
            dir_contents=recursive_listdir(distribution_dir), project=project)

        validate_version_file(project, distribution_dir)
        assert_filemodes(project, extract_dir)