(self)
| 1512 | assert str(self.worker) == self.worker.hostname |
| 1513 | |
| 1514 | def test_start__stop(self): |
| 1515 | worker = self.worker |
| 1516 | worker.blueprint.shutdown_complete.set() |
| 1517 | worker.steps = [MockStep(StartStopStep(self)) for _ in range(4)] |
| 1518 | worker.blueprint.state = RUN |
| 1519 | worker.blueprint.started = 4 |
| 1520 | for w in worker.steps: |
| 1521 | w.start = Mock() |
| 1522 | w.close = Mock() |
| 1523 | w.stop = Mock() |
| 1524 | |
| 1525 | worker.start() |
| 1526 | for w in worker.steps: |
| 1527 | w.start.assert_called() |
| 1528 | worker.consumer = Mock() |
| 1529 | worker.stop(exitcode=3) |
| 1530 | for stopstep in worker.steps: |
| 1531 | stopstep.close.assert_called() |
| 1532 | stopstep.stop.assert_called() |
| 1533 | |
| 1534 | # Doesn't close pool if no pool. |
| 1535 | worker.start() |
| 1536 | worker.pool = None |
| 1537 | worker.stop() |
| 1538 | |
| 1539 | # test that stop of None is not attempted |
| 1540 | worker.steps[-1] = None |
| 1541 | worker.start() |
| 1542 | worker.stop() |
| 1543 | |
| 1544 | def test_start__KeyboardInterrupt(self): |
| 1545 | worker = self.worker |
nothing calls this directly
no test coverage detected