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

Function test_chroot_zip_is_deterministic

tests/test_common.py:198–225  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

196
197
198def test_chroot_zip_is_deterministic():
199 # type: () -> None
200 with temporary_dir() as tmp:
201 root_dir = os.path.join(tmp, "root")
202 dir_a = os.path.join(root_dir, "a")
203 src_path_a = os.path.join(dir_a, "file_a")
204 touch(src_path_a)
205 dir_b = os.path.join(root_dir, "b")
206 src_path_b = os.path.join(dir_b, "file_b")
207 touch(src_path_b)
208
209 chroot = Chroot(os.path.join(tmp, "chroot"))
210 chroot.symlink(root_dir, "root")
211
212 zip_one_dst = os.path.join(tmp, "chroot_one.zip")
213 zip_two_dst = os.path.join(tmp, "chroot_two.zip")
214
215 with mock.patch("os.walk", new=NonDeterministicWalk()):
216 chroot.zip(zip_one_dst)
217 chroot.zip(zip_two_dst)
218
219 with open_zip(zip_one_dst) as zip_file:
220 namelist_one = zip_file.namelist()
221
222 with open_zip(zip_two_dst) as zip_file:
223 namelist_two = zip_file.namelist()
224
225 assert namelist_one == namelist_two
226
227
228def test_chroot_zip_symlink():

Callers

nothing calls this directly

Calls 9

symlinkMethod · 0.95
zipMethod · 0.95
temporary_dirFunction · 0.90
touchFunction · 0.90
ChrootClass · 0.90
open_zipFunction · 0.90
joinMethod · 0.45
patchMethod · 0.45

Tested by

no test coverage detected