(
path, # type: str
expected_comment=b"", # type: bytes
)
| 39 | |
| 40 | |
| 41 | def assert_zipapp( |
| 42 | path, # type: str |
| 43 | expected_comment=b"", # type: bytes |
| 44 | ): |
| 45 | # type: (...) -> None |
| 46 | |
| 47 | with open_zip(path) as zip_fp: |
| 48 | assert ["__main__.py", "data.py", "data"] == zip_fp.namelist() |
| 49 | assert expected_comment == zip_fp.comment |
| 50 | |
| 51 | # Older Pythons cannot execute zipapps with comments. The C runtime has a separate zip |
| 52 | # implementation from the zipfile module, and it chokes. |
| 53 | # See the fix here in 3.8.0 alpha1: https://github.com/python/cpython/issues/50200 |
| 54 | if not expected_comment or PY_VER >= (3, 8): |
| 55 | assert b"42" == subprocess.check_output(args=[sys.executable, path]).strip() |
| 56 | |
| 57 | |
| 58 | def create_zipapp( |
no test coverage detected