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

Method test_new_namespace_for_each_remote_exec

Lib/test/test_sys.py:2165–2176  ·  view source on GitHub ↗

Test that each remote_exec call gets its own namespace.

(self)

Source from the content-addressed store, hash-verified

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."""
2167 script = textwrap.dedent(
2168 """
2169 assert globals() is not __import__("__main__").__dict__
2170 print("Remote script executed successfully!")
2171 """
2172 )
2173 returncode, stdout, stderr = self._run_remote_exec_test(script)
2174 self.assertEqual(returncode, 0)
2175 self.assertEqual(stderr, b"")
2176 self.assertIn(b"Remote script executed successfully", stdout)
2177
2178 def test_remote_exec_disabled_by_env(self):
2179 """Test remote exec is disabled when PYTHON_DISABLE_REMOTE_DEBUG is set"""

Callers

nothing calls this directly

Calls 4

_run_remote_exec_testMethod · 0.95
assertInMethod · 0.80
dedentMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected