(self)
| 1329 | |
| 1330 | @warnings_helper.ignore_fork_in_thread_deprecation_warnings() |
| 1331 | def test_fork(self): |
| 1332 | # Old versions of Queue would fail to create a new feeder |
| 1333 | # thread for a forked process if the original process had its |
| 1334 | # own feeder thread. This test checks that this no longer |
| 1335 | # happens. |
| 1336 | |
| 1337 | queue = self.Queue() |
| 1338 | |
| 1339 | # put items on queue so that main process starts a feeder thread |
| 1340 | for i in range(10): |
| 1341 | queue.put(i) |
| 1342 | |
| 1343 | # wait to make sure thread starts before we fork a new process |
| 1344 | time.sleep(DELTA) |
| 1345 | |
| 1346 | # fork process |
| 1347 | p = self.Process(target=self._test_fork, args=(queue,)) |
| 1348 | p.daemon = True |
| 1349 | p.start() |
| 1350 | |
| 1351 | # check that all expected items are in the queue |
| 1352 | for i in range(20): |
| 1353 | self.assertEqual(queue.get(), i) |
| 1354 | self.assertRaises(pyqueue.Empty, queue.get, False) |
| 1355 | |
| 1356 | p.join() |
| 1357 | close_queue(queue) |
| 1358 | |
| 1359 | def test_qsize(self): |
| 1360 | q = self.Queue() |
nothing calls this directly
no test coverage detected