MCPcopy Index your code
hub / github.com/python/cpython / test_in_thread

Method test_in_thread

Lib/test/test_interpreters/test_api.py:962–976  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

960 self.assertEqual(stdout, '')
961
962 def test_in_thread(self):
963 interp = interpreters.create()
964 script, results = _captured_script('print("it worked!", end="")')
965 with results:
966 def f():
967 interp.exec(script)
968
969 t = threading.Thread(target=f)
970 t.start()
971 t.join()
972 results = results.final()
973 results.raise_if_failed()
974 out = results.stdout
975
976 self.assertEqual(out, 'it worked!')
977
978 @support.requires_fork()
979 def test_fork(self):

Callers

nothing calls this directly

Calls 7

startMethod · 0.95
joinMethod · 0.95
finalMethod · 0.80
raise_if_failedMethod · 0.80
_captured_scriptFunction · 0.70
createMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected