Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 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)
Example #4
0
 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)
Example #5
0
 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)
Example #6
0
 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,
     )
Example #7
0
 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, )