def test_create_threaded(self): w = Mock() w.use_eventloop = False x = WorkerComponent(w) x.instantiate = Mock() r = x.create(w) x.instantiate.assert_called_with(w.autoreloader_cls, w) self.assertIs(r, w.autoreloader)
def test_create(self): w = Mock() x = WorkerComponent(w) x.instantiate = Mock() r = x.create(w) x.instantiate.assert_called_with(w.autoreloader_cls, controller=w) self.assertIs(r, w.autoreloader)
def test_create_ev(self, kqueue, kevent): w = Mock() w.use_eventloop = True x = WorkerComponent(w) x.instantiate = Mock() r = x.create(w) x.instantiate.assert_called_with(w.autoreloader_cls, w) self.assertIsNone(r) w.hub.on_init.append.assert_called_with(w.autoreloader.on_poll_init) w.hub.on_close.append.assert_called_with(w.autoreloader.on_poll_close)
def test_create_ev(self, kq, kqueue, kevent): w = Mock() w.use_eventloop = True x = WorkerComponent(w) x.instantiate = Mock() r = x.create(w) x.instantiate.assert_called_with(w.autoreloader_cls, w) x.register_with_event_loop(w, w.hub) self.assertIsNone(r) w.hub.on_close.add.assert_called_with( w.autoreloader.on_event_loop_close, )
def test_create_ev(self, kqueue, kevent): w = Mock() w.use_eventloop = True x = WorkerComponent(w) x.instantiate = Mock() r = x.create(w) x.instantiate.assert_called_with(w.autoreloader_cls, w) x.register_with_event_loop(w, w.hub) self.assertIsNone(r) w.hub.on_close.add.assert_called_with( w.autoreloader.on_event_loop_close, )