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

Function assert_zipapp

tests/test_zip_utils.py:41–55  ·  view source on GitHub ↗
(
    path,  # type: str
    expected_comment=b"",  # type: bytes
)

Source from the content-addressed store, hash-verified

39
40
41def 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
58def create_zipapp(

Callers 3

create_zipappFunction · 0.85
test_header_isolationFunction · 0.85
test_sandwichFunction · 0.85

Calls 2

open_zipFunction · 0.90
stripMethod · 0.80

Tested by

no test coverage detected