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

Function assert_chroot_perms

tests/test_common.py:135–158  ·  view source on GitHub ↗
(copyfn)

Source from the content-addressed store, hash-verified

133
134
135def assert_chroot_perms(copyfn):
136 with temporary_dir() as src:
137 one = os.path.join(src, "one")
138 touch(one)
139
140 two = os.path.join(src, "two")
141 touch(two)
142 chmod_plus_x(two)
143
144 with temporary_dir() as dst:
145 chroot = Chroot(dst)
146 copyfn(chroot, one, "one")
147 copyfn(chroot, two, "two")
148 assert extract_perms(one) == extract_perms(os.path.join(chroot.path(), "one"))
149 assert extract_perms(two) == extract_perms(os.path.join(chroot.path(), "two"))
150
151 zip_path = os.path.join(src, "chroot.zip")
152 chroot.zip(zip_path)
153 with temporary_dir() as extract_dir:
154 with contextlib.closing(ZipFileEx(zip_path)) as zf:
155 zf.extractall(extract_dir)
156
157 assert not is_executable(os.path.join(extract_dir, "one"))
158 assert is_executable(os.path.join(extract_dir, "two"))
159
160
161def test_chroot_perms_copy():

Calls 11

pathMethod · 0.95
zipMethod · 0.95
temporary_dirFunction · 0.90
touchFunction · 0.90
chmod_plus_xFunction · 0.90
ChrootClass · 0.90
ZipFileExClass · 0.90
extract_permsFunction · 0.85
is_executableFunction · 0.85
extractallMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected