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

Method test_remote_exec_with_exception

Lib/test/test_sys.py:2151–2163  ·  view source on GitHub ↗

Test remote exec with an exception raised in the target process The exception should be raised in the main thread of the target process but not crash the target process.

(self)

Source from the content-addressed store, hash-verified

2149 self.assertEqual(stderr, b"")
2150
2151 def test_remote_exec_with_exception(self):
2152 """Test remote exec with an exception raised in the target process
2153
2154 The exception should be raised in the main thread of the target process
2155 but not crash the target process.
2156 """
2157 script = '''
2158raise Exception("Remote script exception")
2159'''
2160 returncode, stdout, stderr = self._run_remote_exec_test(script)
2161 self.assertEqual(returncode, 0)
2162 self.assertIn(b"Remote script exception", stderr)
2163 self.assertEqual(stdout.strip(), b"Target process running...")
2164
2165 def test_new_namespace_for_each_remote_exec(self):
2166 """Test that each remote_exec call gets its own namespace."""

Callers

nothing calls this directly

Calls 4

_run_remote_exec_testMethod · 0.95
assertInMethod · 0.80
assertEqualMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected