MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_remote_exec_with_exception

Method test_remote_exec_with_exception

Lib/test/test_sys.py:2123–2135  ·  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

2121 self.assertEqual(stderr, b"")
2122
2123 def test_remote_exec_with_exception(self):
2124 """Test remote exec with an exception raised in the target process
2125
2126 The exception should be raised in the main thread of the target process
2127 but not crash the target process.
2128 """
2129 script = '''
2130raise Exception("Remote script exception")
2131'''
2132 returncode, stdout, stderr = self._run_remote_exec_test(script)
2133 self.assertEqual(returncode, 0)
2134 self.assertIn(b"Remote script exception", stderr)
2135 self.assertEqual(stdout.strip(), b"Target process running...")
2136
2137 def test_new_namespace_for_each_remote_exec(self):
2138 """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