(copyfn)
| 133 | |
| 134 | |
| 135 | def 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 | |
| 161 | def test_chroot_perms_copy(): |
no test coverage detected