()
| 60 | |
| 61 | @contextlib.contextmanager |
| 62 | def zip_fixture(): |
| 63 | # type: () -> Iterator[Tuple[str, str]] |
| 64 | with temporary_dir() as target_dir: |
| 65 | no_x = os.path.join(target_dir, "no-x") |
| 66 | touch(no_x) |
| 67 | |
| 68 | no_w = os.path.join(target_dir, "no-w") |
| 69 | touch(no_w) |
| 70 | os.chmod(no_w, 0o444) |
| 71 | |
| 72 | with_x = os.path.join(target_dir, "with-x") |
| 73 | touch(with_x) |
| 74 | chmod_plus_x(with_x) |
| 75 | |
| 76 | assert extract_perms(no_x) != extract_perms(no_w) != extract_perms(with_x) |
| 77 | |
| 78 | zip_file = os.path.join(target_dir, "test.zip") |
| 79 | with contextlib.closing(ZipFileEx(zip_file, "w")) as zf: |
| 80 | zf.write(no_x, "no-x") |
| 81 | zf.write(no_w, "no-w") |
| 82 | zf.write(with_x, "with-x") |
| 83 | |
| 84 | yield zip_file, os.path.join(target_dir, "extract") |
| 85 | |
| 86 | |
| 87 | def is_writeable(path): |
no test coverage detected