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

Function test_spawn_stdout

tests/test_jobs.py:107–125  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

105
106
107def test_spawn_stdout():
108 # type: () -> None
109 assert (
110 "Jane\n"
111 == SpawnedJob.stdout(
112 job=spawn_python_job(
113 args=["-c", "import sys; print(sys.stdin.read())"],
114 stdin=subprocess.PIPE,
115 stdout=subprocess.PIPE,
116 ),
117 result_func=lambda stdout: stdout.decode("utf-8"),
118 input=b"Jane",
119 ).await_result()
120 )
121
122 spawned_job = SpawnedJob.stdout(create_error_job(137), lambda output: 42)
123 with pytest.raises(Job.Error) as exec_info:
124 spawned_job.await_result()
125 assert 137 == exec_info.value.exitcode

Callers

nothing calls this directly

Calls 5

spawn_python_jobFunction · 0.85
create_error_jobFunction · 0.85
stdoutMethod · 0.80
decodeMethod · 0.80
await_resultMethod · 0.45

Tested by

no test coverage detected