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

Method test_process

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

Source from the content-addressed store, hash-verified

505
506 @warnings_helper.ignore_fork_in_thread_deprecation_warnings()
507 def test_process(self):
508 q = self.Queue(1)
509 e = self.Event()
510 args = (q, 1, 2)
511 kwargs = {'hello':23, 'bye':2.54}
512 name = 'SomeProcess'
513 p = self.Process(
514 target=self._test, args=args, kwargs=kwargs, name=name
515 )
516 p.daemon = True
517 current = self.current_process()
518
519 if self.TYPE != 'threads':
520 self.assertEqual(p.authkey, current.authkey)
521 self.assertEqual(p.is_alive(), False)
522 self.assertEqual(p.daemon, True)
523 self.assertNotIn(p, self.active_children())
524 self.assertIs(type(self.active_children()), list)
525 self.assertEqual(p.exitcode, None)
526
527 p.start()
528
529 self.assertEqual(p.exitcode, None)
530 self.assertEqual(p.is_alive(), True)
531 self.assertIn(p, self.active_children())
532
533 self.assertEqual(q.get(), args[1:])
534 self.assertEqual(q.get(), kwargs)
535 self.assertEqual(q.get(), p.name)
536 if self.TYPE != 'threads':
537 self.assertEqual(q.get(), current.authkey)
538 self.assertEqual(q.get(), p.pid)
539
540 p.join()
541
542 self.assertEqual(p.exitcode, 0)
543 self.assertEqual(p.is_alive(), False)
544 self.assertNotIn(p, self.active_children())
545 close_queue(q)
546
547 @warnings_helper.ignore_fork_in_thread_deprecation_warnings()
548 @unittest.skipUnless(threading._HAVE_THREAD_NATIVE_ID, "needs native_id")

Callers

nothing calls this directly

Calls 12

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

Tested by

no test coverage detected