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

Method setUp

Lib/test/_test_multiprocessing.py:6420–6431  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

6418 START_METHODS = {"forkserver", "spawn"}
6419
6420 def setUp(self):
6421 self._orig_sys_path = list(sys.path)
6422 self._temp_dir = tempfile.mkdtemp(prefix="test_sys_path-")
6423 self._mod_name = "unique_test_mod"
6424 module_path = os.path.join(self._temp_dir, f"{self._mod_name}.py")
6425 with open(module_path, "w", encoding="utf-8") as mod:
6426 mod.write("# A simple test module\n")
6427 sys.path[:] = [p for p in sys.path if p] # remove any existing ""s
6428 sys.path.insert(0, self._temp_dir)
6429 sys.path.insert(0, "") # Replaced with an abspath in child.
6430 self.assertIn(self.start_method, self.START_METHODS)
6431 self._ctx = multiprocessing.get_context(self.start_method)
6432
6433 def tearDown(self):
6434 sys.path[:] = self._orig_sys_path

Callers

nothing calls this directly

Calls 8

listClass · 0.85
mkdtempMethod · 0.80
assertInMethod · 0.80
openFunction · 0.50
joinMethod · 0.45
writeMethod · 0.45
insertMethod · 0.45
get_contextMethod · 0.45

Tested by

no test coverage detected