(self)
| 1609 | assert w.process_task is w._process_task |
| 1610 | |
| 1611 | def test_Pool_create(self): |
| 1612 | from kombu.asynchronous.semaphore import LaxBoundedSemaphore |
| 1613 | w = Mock() |
| 1614 | w._conninfo.connection_errors = w._conninfo.channel_errors = () |
| 1615 | w.hub = Mock() |
| 1616 | |
| 1617 | PoolImp = Mock() |
| 1618 | poolimp = PoolImp.return_value = Mock() |
| 1619 | poolimp._pool = [Mock(), Mock()] |
| 1620 | poolimp._cache = {} |
| 1621 | poolimp._fileno_to_inq = {} |
| 1622 | poolimp._fileno_to_outq = {} |
| 1623 | |
| 1624 | from celery.concurrency.prefork import TaskPool as _TaskPool |
| 1625 | |
| 1626 | class MockTaskPool(_TaskPool): |
| 1627 | Pool = PoolImp |
| 1628 | |
| 1629 | @property |
| 1630 | def timers(self): |
| 1631 | return {Mock(): 30} |
| 1632 | |
| 1633 | w.pool_cls = MockTaskPool |
| 1634 | w.use_eventloop = True |
| 1635 | w.consumer.restart_count = -1 |
| 1636 | pool = components.Pool(w) |
| 1637 | # Starting the pool can mark this process as a spawned pool child, |
| 1638 | # which changes how @app.task binds for every test that follows. |
| 1639 | with restore_execv_state(): |
| 1640 | pool.create(w) |
| 1641 | pool.register_with_event_loop(w, w.hub) |
| 1642 | if sys.platform != 'win32': |
| 1643 | assert isinstance(w.semaphore, LaxBoundedSemaphore) |
| 1644 | P = w.pool |
| 1645 | P.start() |
| 1646 | |
| 1647 | def test_wait_for_soft_shutdown(self): |
| 1648 | worker = self.worker |
nothing calls this directly
no test coverage detected