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

Function test_pex_builder_preamble

tests/test_pex_builder.py:77–97  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

75
76
77def test_pex_builder_preamble():
78 # type: () -> None
79 with temporary_dir() as td:
80 target = os.path.join(td, "foo.pex")
81 should_create = os.path.join(td, "foo.1")
82
83 tempfile_preamble = "\n".join(
84 ["import sys", "open('{0}', 'w').close()".format(should_create), "sys.exit(3)"]
85 )
86
87 pb = PEXBuilder(preamble=tempfile_preamble)
88 pb.build(target)
89
90 assert not os.path.exists(should_create)
91
92 pex = PEX(target, interpreter=pb.interpreter)
93 process = pex.run(blocking=False)
94 process.wait()
95
96 assert process.returncode == 3
97 assert os.path.exists(should_create)
98
99
100def test_pex_builder_compilation():

Callers

nothing calls this directly

Calls 7

buildMethod · 0.95
runMethod · 0.95
temporary_dirFunction · 0.90
PEXBuilderClass · 0.90
PEXClass · 0.90
joinMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected