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

Function test_chroot_zip

tests/test_common.py:180–195  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

178
179
180def test_chroot_zip():
181 # type: () -> None
182 with temporary_dir() as tmp:
183 chroot = Chroot(os.path.join(tmp, "chroot"))
184 chroot.write(b"data", "directory/subdirectory/file")
185 zip_dst = os.path.join(tmp, "chroot.zip")
186 chroot.zip(zip_dst)
187 with open_zip(zip_dst) as zip:
188 assert [
189 "directory/",
190 "directory/subdirectory/",
191 "directory/subdirectory/file",
192 ] == sorted(zip.namelist())
193 assert b"" == zip.read("directory/")
194 assert b"" == zip.read("directory/subdirectory/")
195 assert b"data" == zip.read("directory/subdirectory/file")
196
197
198def test_chroot_zip_is_deterministic():

Callers

nothing calls this directly

Calls 7

writeMethod · 0.95
zipMethod · 0.95
temporary_dirFunction · 0.90
ChrootClass · 0.90
open_zipFunction · 0.90
joinMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected