MCPcopy
hub / github.com/pex-tool/pex / zip_fixture

Function zip_fixture

tests/test_common.py:62–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60
61@contextlib.contextmanager
62def zip_fixture():
63 # type: () -> Iterator[Tuple[str, str]]
64 with temporary_dir() as target_dir:
65 no_x = os.path.join(target_dir, "no-x")
66 touch(no_x)
67
68 no_w = os.path.join(target_dir, "no-w")
69 touch(no_w)
70 os.chmod(no_w, 0o444)
71
72 with_x = os.path.join(target_dir, "with-x")
73 touch(with_x)
74 chmod_plus_x(with_x)
75
76 assert extract_perms(no_x) != extract_perms(no_w) != extract_perms(with_x)
77
78 zip_file = os.path.join(target_dir, "test.zip")
79 with contextlib.closing(ZipFileEx(zip_file, "w")) as zf:
80 zf.write(no_x, "no-x")
81 zf.write(no_w, "no-w")
82 zf.write(with_x, "with-x")
83
84 yield zip_file, os.path.join(target_dir, "extract")
85
86
87def is_writeable(path):

Calls 7

temporary_dirFunction · 0.90
touchFunction · 0.90
chmod_plus_xFunction · 0.90
ZipFileExClass · 0.90
extract_permsFunction · 0.85
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected