Example #1
0
 def test_stop(self):
     x = Autoreloader(Mock(), modules=[__name__])
     x._monitor = None
     x.stop()
     x._monitor = Mock()
     x.stop()
     x._monitor.stop.assert_called_with()
Example #2
0
 def test_stop(self):
     x = Autoreloader(Mock(), modules=[__name__])
     x._monitor = None
     x.stop()
     x._monitor = Mock()
     x.stop()
     x._monitor.stop.assert_called_with()
Example #3
0
 def test_on_event_loop_close(self):
     x = Autoreloader(Mock(), modules=[__name__])
     hub = Mock()
     x._monitor = Mock()
     x.on_event_loop_close(hub)
     x._monitor.on_event_loop_close.assert_called_with(hub)
     x._monitor = None
     x.on_event_loop_close(hub)
Example #4
0
 def test_on_event_loop_close(self):
     x = Autoreloader(Mock(), modules=[__name__])
     hub = Mock()
     x._monitor = Mock()
     x.on_event_loop_close(hub)
     x._monitor.on_event_loop_close.assert_called_with(hub)
     x._monitor = None
     x.on_event_loop_close(hub)
Example #5
0
    def test_on_poll_init(self):
        x = Autoreloader(Mock(), modules=[__name__])
        hub = Mock()
        x._monitor = None
        x.on_init = Mock()
        def se(*args, **kwargs):
            x._monitor = Mock()
        x.on_init.side_effect = se
        x.on_poll_init(hub)
        x.on_init.assert_called_with()
        x._monitor.on_poll_init.assert_called_with(hub)

        x._monitor.on_poll_init.reset_mock()
        x.on_poll_init(hub)
        x._monitor.on_poll_init.assert_called_with(hub)
Example #6
0
    def test_register_with_event_loop(self):
        x = Autoreloader(Mock(), modules=[__name__])
        hub = Mock()
        x._monitor = None
        x.on_init = Mock()

        def se(*args, **kwargs):
            x._monitor = Mock()
        x.on_init.side_effect = se

        x.register_with_event_loop(hub)
        x.on_init.assert_called_with()
        x._monitor.register_with_event_loop.assert_called_with(hub)

        x._monitor.register_with_event_loop.reset_mock()
        x.register_with_event_loop(hub)
        x._monitor.register_with_event_loop.assert_called_with(hub)
Example #7
0
    def test_register_with_event_loop(self):
        x = Autoreloader(Mock(), modules=[__name__])
        hub = Mock()
        x._monitor = None
        x.on_init = Mock()

        def se(*args, **kwargs):
            x._monitor = Mock()
        x.on_init.side_effect = se

        x.register_with_event_loop(hub)
        x.on_init.assert_called_with()
        x._monitor.register_with_event_loop.assert_called_with(hub)

        x._monitor.register_with_event_loop.reset_mock()
        x.register_with_event_loop(hub)
        x._monitor.register_with_event_loop.assert_called_with(hub)
Example #8
0
    def test_on_poll_init(self):
        x = Autoreloader(Mock(), modules=[__name__])
        hub = Mock()
        x._monitor = None
        x.on_init = Mock()

        def se(*args, **kwargs):
            x._monitor = Mock()

        x.on_init.side_effect = se
        x.on_poll_init(hub)
        x.on_init.assert_called_with()
        x._monitor.on_poll_init.assert_called_with(hub)

        x._monitor.on_poll_init.reset_mock()
        x.on_poll_init(hub)
        x._monitor.on_poll_init.assert_called_with(hub)