(self)
| 758 | |
| 759 | @warnings_helper.ignore_fork_in_thread_deprecation_warnings() |
| 760 | def test_close(self): |
| 761 | if self.TYPE == "threads": |
| 762 | self.skipTest('test not appropriate for {}'.format(self.TYPE)) |
| 763 | q = self.Queue() |
| 764 | p = self.Process(target=self._test_close, kwargs={'q': q}) |
| 765 | p.daemon = True |
| 766 | p.start() |
| 767 | self.assertEqual(p.is_alive(), True) |
| 768 | # Child is still alive, cannot close |
| 769 | with self.assertRaises(ValueError): |
| 770 | p.close() |
| 771 | |
| 772 | q.put(None) |
| 773 | p.join() |
| 774 | self.assertEqual(p.is_alive(), False) |
| 775 | self.assertEqual(p.exitcode, 0) |
| 776 | p.close() |
| 777 | with self.assertRaises(ValueError): |
| 778 | p.is_alive() |
| 779 | with self.assertRaises(ValueError): |
| 780 | p.join() |
| 781 | with self.assertRaises(ValueError): |
| 782 | p.terminate() |
| 783 | p.close() |
| 784 | |
| 785 | wr = weakref.ref(p) |
| 786 | del p |
| 787 | gc.collect() |
| 788 | self.assertIs(wr(), None) |
| 789 | |
| 790 | close_queue(q) |
| 791 | |
| 792 | @warnings_helper.ignore_fork_in_thread_deprecation_warnings() |
| 793 | @support.requires_resource('walltime') |
nothing calls this directly
no test coverage detected