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

Method test_close

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

Source from the content-addressed store, hash-verified

669 sys.exit(rc)
670
671 def test_close(self):
672 if self.TYPE == "threads":
673 self.skipTest('test not appropriate for {}'.format(self.TYPE))
674 q = self.Queue()
675 p = self.Process(target=self._test_close, kwargs={'q': q})
676 p.daemon = True
677 p.start()
678 self.assertEqual(p.is_alive(), True)
679 # Child is still alive, cannot close
680 with self.assertRaises(ValueError):
681 p.close()
682
683 q.put(None)
684 p.join()
685 self.assertEqual(p.is_alive(), False)
686 self.assertEqual(p.exitcode, 0)
687 p.close()
688 with self.assertRaises(ValueError):
689 p.is_alive()
690 with self.assertRaises(ValueError):
691 p.join()
692 with self.assertRaises(ValueError):
693 p.terminate()
694 p.close()
695
696 wr = weakref.ref(p)
697 del p
698 gc.collect()
699 self.assertIs(wr(), None)
700
701 close_queue(q)
702
703 @support.requires_resource('walltime')
704 def test_many_processes(self):

Callers

nothing calls this directly

Calls 15

putMethod · 0.95
terminateMethod · 0.95
close_queueFunction · 0.85
skipTestMethod · 0.80
QueueMethod · 0.80
collectMethod · 0.80
formatMethod · 0.45
ProcessMethod · 0.45
startMethod · 0.45
assertEqualMethod · 0.45
is_aliveMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected