当前位置: 首页>>代码示例>>Python>>正文


Python autoreload.Autoreloader类代码示例

本文整理汇总了Python中celery.worker.autoreload.Autoreloader的典型用法代码示例。如果您正苦于以下问题:Python Autoreloader类的具体用法?Python Autoreloader怎么用?Python Autoreloader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Autoreloader类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_stop

 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()
开发者ID:1995rishi,项目名称:flaskmap,代码行数:7,代码来源:test_autoreload.py

示例2: test_on_event_loop_close

 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)
开发者ID:1995rishi,项目名称:flaskmap,代码行数:8,代码来源:test_autoreload.py

示例3: test_start

 def test_start(self, fhash):
     x = Autoreloader(Mock(), modules=[__name__])
     x.Monitor = Mock()
     mon = x.Monitor.return_value = Mock()
     mon.start.side_effect = OSError()
     mon.start.side_effect.errno = errno.EINTR
     x.body()
     mon.start.side_effect.errno = errno.ENOENT
     with self.assertRaises(OSError):
         x.body()
     mon.start.side_effect = None
     x.body()
开发者ID:1995rishi,项目名称:flaskmap,代码行数:12,代码来源:test_autoreload.py

示例4: test_on_change

 def test_on_change(self):
     x = Autoreloader(Mock(), modules=[__name__])
     mm = x._maybe_modified = Mock(0)
     mm.return_value = True
     x._reload = Mock()
     x.file_to_module[__name__] = __name__
     x.on_change([__name__])
     self.assertTrue(x._reload.called)
     mm.return_value = False
     x.on_change([__name__])
开发者ID:1995rishi,项目名称:flaskmap,代码行数:10,代码来源:test_autoreload.py

示例5: test_maybe_modified

 def test_maybe_modified(self, exists, fhash):
     exists.return_value = True
     fhash.return_value = 'abcd'
     x = Autoreloader(Mock(), modules=[__name__])
     x._hashes = {}
     x._hashes[__name__] = 'dcba'
     self.assertTrue(x._maybe_modified(__name__))
     x._hashes[__name__] = 'abcd'
     self.assertFalse(x._maybe_modified(__name__))
     exists.return_value = False
     self.assertFalse(x._maybe_modified(__name__))
开发者ID:1995rishi,项目名称:flaskmap,代码行数:11,代码来源:test_autoreload.py

示例6: test_maybe_modified

 def test_maybe_modified(self, fhash):
     fhash.return_value = "abcd"
     x = Autoreloader(Mock(), modules=[__name__])
     x._hashes = {}
     x._hashes[__name__] = "dcba"
     self.assertTrue(x._maybe_modified(__name__))
     x._hashes[__name__] = "abcd"
     self.assertFalse(x._maybe_modified(__name__))
开发者ID:ahalife,项目名称:celery,代码行数:8,代码来源:test_autoreload.py

示例7: test_on_poll_init

    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)
开发者ID:charettes,项目名称:celery,代码行数:15,代码来源:test_autoreload.py

示例8: test_register_with_event_loop

    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)
开发者ID:1995rishi,项目名称:flaskmap,代码行数:17,代码来源:test_autoreload.py

示例9: test_reload

 def test_reload(self):
     x = Autoreloader(Mock(), modules=[__name__])
     x._reload([__name__])
     x.controller.reload.assert_called_with([__name__], reload=True)
开发者ID:1995rishi,项目名称:flaskmap,代码行数:4,代码来源:test_autoreload.py

示例10: test_module_name

 def test_module_name(self):
     x = Autoreloader(Mock(), modules=[__name__])
     self.assertEqual(x._module_name("foo/bar/baz.py"), "baz")
开发者ID:ahalife,项目名称:celery,代码行数:3,代码来源:test_autoreload.py


注:本文中的celery.worker.autoreload.Autoreloader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。