Changeset View
Changeset View
Standalone View
Standalone View
swh/core/tests/test_tarball.py
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | def test_uncompress_tar(tmp_path, datadir): | ||||
extract_dir = os.path.join(tmp_path, filename) | extract_dir = os.path.join(tmp_path, filename) | ||||
tarball.uncompress(tarpath, extract_dir) | tarball.uncompress(tarpath, extract_dir) | ||||
assert len(os.listdir(extract_dir)) > 0 | assert len(os.listdir(extract_dir)) > 0 | ||||
def test_uncompress_tarzst(tmp_path, datadir): | |||||
"""Unpack supported zst tarball into an existent folder should be ok""" | |||||
filename = "ca-certificates-20210603-1-any.pkg.tar.zst" | |||||
tarpath = os.path.join(datadir, "archives", filename) | |||||
assert os.path.exists(tarpath) | |||||
extract_dir = os.path.join(tmp_path, filename) | |||||
tarball.uncompress(tarpath, extract_dir) | |||||
assert len(os.listdir(extract_dir)) > 0 | |||||
def test_register_new_archive_formats(prepare_shutil_state): | def test_register_new_archive_formats(prepare_shutil_state): | ||||
"""Registering new archive formats should be fine""" | """Registering new archive formats should be fine""" | ||||
unpack_formats_v1 = [f[0] for f in shutil.get_unpack_formats()] | unpack_formats_v1 = [f[0] for f in shutil.get_unpack_formats()] | ||||
for format_id in tarball.ADDITIONAL_ARCHIVE_FORMATS: | for format_id in tarball.ADDITIONAL_ARCHIVE_FORMATS: | ||||
assert format_id[0] not in unpack_formats_v1 | assert format_id[0] not in unpack_formats_v1 | ||||
# when | # when | ||||
tarball.register_new_archive_formats() | tarball.register_new_archive_formats() | ||||
▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines |