Changeset View
Changeset View
Standalone View
Standalone View
swh/core/tests/test_tarball.py
Show First 20 Lines • Show All 216 Lines • ▼ Show 20 Lines | def test_unpcompress_zip_imploded(tmp_path, datadir): | ||||
assert os.path.exists(zippath) | assert os.path.exists(zippath) | ||||
extract_dir = os.path.join(tmp_path, filename) | extract_dir = os.path.join(tmp_path, filename) | ||||
tarball.uncompress(zippath, extract_dir) | tarball.uncompress(zippath, extract_dir) | ||||
assert len(os.listdir(extract_dir)) > 0 | assert len(os.listdir(extract_dir)) > 0 | ||||
def test_uncompress_upper_archive_extension(tmp_path, datadir): | |||||
"""Copy test archives in a temporary directory but turn their names | |||||
to uppercase, then check they can be successfully extracted. | |||||
""" | |||||
archives_path = os.path.join(datadir, "archives") | |||||
archive_files = [ | |||||
f | |||||
for f in os.listdir(archives_path) | |||||
if os.path.isfile(os.path.join(archives_path, f)) | |||||
] | |||||
for archive_file in archive_files: | |||||
archive_file_upper = os.path.join(tmp_path, archive_file.upper()) | |||||
extract_dir = os.path.join(tmp_path, archive_file) | |||||
shutil.copy(os.path.join(archives_path, archive_file), archive_file_upper) | |||||
tarball.uncompress(archive_file_upper, extract_dir) | |||||
assert len(os.listdir(extract_dir)) > 0 |