/usr/local/lib/python3.6/site-packages/importlib_resources/tests
NameSizeModeActions
data01/-0755rm
data02/-0755rm
namespacedata01/-0755rm
zipdata01/-0755rm
zipdata02/-0755rm
__pycache__/-0755rm
test_compatibilty_files.py32600644editdlrm
test_contents.py9680644editdlrm
test_files.py11840644editdlrm
test_open.py25650644editdlrm
test_path.py21030644editdlrm
test_read.py24080644editdlrm
test_reader.py42860644editdlrm
test_resource.py81450644editdlrm
update-zips.py14150644editdlrm
util.py53090644editdlrm
_compat.py4350644editdlrm
__init__.py00644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/importlib_resources/tests/update-zips.py (1415B)
""" Generate the zip test data files. Run to build the tests/zipdataNN/ziptestdata.zip files from files in tests/dataNN. Replaces the file with the working copy, but does commit anything to the source repo. """ import contextlib import os import pathlib import zipfile def main(): """ >>> from unittest import mock >>> monkeypatch = getfixture('monkeypatch') >>> monkeypatch.setattr(zipfile, 'ZipFile', mock.MagicMock()) >>> print(); main() # print workaround for bpo-32509 ...data01... -> ziptestdata/... ... ...data02... -> ziptestdata/... ... """ suffixes = '01', '02' tuple(map(generate, suffixes)) def generate(suffix): root = pathlib.Path(__file__).parent.relative_to(os.getcwd()) zfpath = root / f'zipdata{suffix}/ziptestdata.zip' with zipfile.ZipFile(zfpath, 'w') as zf: for src, rel in walk(root / f'data{suffix}'): dst = 'ziptestdata' / pathlib.PurePosixPath(rel.as_posix()) print(src, '->', dst) zf.write(src, dst) def walk(datapath): for dirpath, dirnames, filenames in os.walk(datapath): with contextlib.suppress(KeyError): dirnames.remove('__pycache__') for filename in filenames: res = pathlib.Path(dirpath) / filename rel = res.relative_to(datapath) yield res, rel __name__ == '__main__' and main()