| 178 | |
| 179 | |
| 180 | def 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 | |
| 198 | def test_chroot_zip_is_deterministic(): |