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

Method test_process

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

Source from the content-addressed store, hash-verified

446 wconn.send("alive" if parent_process().is_alive() else "not alive")
447
448 def test_process(self):
449 q = self.Queue(1)
450 e = self.Event()
451 args = (q, 1, 2)
452 kwargs = {'hello':23, 'bye':2.54}
453 name = 'SomeProcess'
454 p = self.Process(
455 target=self._test, args=args, kwargs=kwargs, name=name
456 )
457 p.daemon = True
458 current = self.current_process()
459
460 if self.TYPE != 'threads':
461 self.assertEqual(p.authkey, current.authkey)
462 self.assertEqual(p.is_alive(), False)
463 self.assertEqual(p.daemon, True)
464 self.assertNotIn(p, self.active_children())
465 self.assertTrue(type(self.active_children()) is list)
466 self.assertEqual(p.exitcode, None)
467
468 p.start()
469
470 self.assertEqual(p.exitcode, None)
471 self.assertEqual(p.is_alive(), True)
472 self.assertIn(p, self.active_children())
473
474 self.assertEqual(q.get(), args[1:])
475 self.assertEqual(q.get(), kwargs)
476 self.assertEqual(q.get(), p.name)
477 if self.TYPE != 'threads':
478 self.assertEqual(q.get(), current.authkey)
479 self.assertEqual(q.get(), p.pid)
480
481 p.join()
482
483 self.assertEqual(p.exitcode, 0)
484 self.assertEqual(p.is_alive(), False)
485 self.assertNotIn(p, self.active_children())
486 close_queue(q)
487
488 @unittest.skipUnless(threading._HAVE_THREAD_NATIVE_ID, "needs native_id")
489 def test_process_mainthread_native_id(self):

Callers

nothing calls this directly

Calls 12

getMethod · 0.95
close_queueFunction · 0.85
QueueMethod · 0.80
EventMethod · 0.80
assertNotInMethod · 0.80
assertTrueMethod · 0.80
assertInMethod · 0.80
ProcessMethod · 0.45
assertEqualMethod · 0.45
is_aliveMethod · 0.45
startMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected