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

Function test_execute_repl_with_python_options

tests/test_pex.py:867–894  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

865
866
867def test_execute_repl_with_python_options():
868 with temporary_dir() as pex_chroot:
869 pex_builder = PEXBuilder(path=pex_chroot)
870 pex_builder.freeze()
871 process = PEX(pex_chroot).run(
872 args=["-O"],
873 stdout=subprocess.PIPE,
874 stderr=subprocess.PIPE,
875 stdin=subprocess.PIPE,
876 blocking=False,
877 )
878 # adding the -O option will ignore that assertion
879 # see: https://docs.python.org/3/using/cmdline.html#cmdoption-O
880 # We should not see the AssertionError in the output anymore.
881 commands = dedent(
882 """
883 assert False
884 20 + 103
885 quit()
886 """
887 )
888 stdout, stderr = process.communicate(input=commands.encode("utf-8"))
889
890 assert stderr.startswith(EXPECTED_REPL_BANNER_NO_DEPS), stderr
891 assert b"AssertionError" not in stderr
892 assert b">>> " in stdout
893 assert b"123" in stdout
894 assert 0 == process.returncode
895
896
897def test_pex_run_strip_env():

Callers

nothing calls this directly

Calls 7

freezeMethod · 0.95
temporary_dirFunction · 0.90
PEXBuilderClass · 0.90
PEXClass · 0.90
communicateMethod · 0.80
runMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected