本文整理汇总了Python中celery.worker.autoreload.Autoreloader.on_init方法的典型用法代码示例。如果您正苦于以下问题:Python Autoreloader.on_init方法的具体用法?Python Autoreloader.on_init怎么用?Python Autoreloader.on_init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类celery.worker.autoreload.Autoreloader
的用法示例。
在下文中一共展示了Autoreloader.on_init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_on_poll_init
# 需要导入模块: from celery.worker.autoreload import Autoreloader [as 别名]
# 或者: from celery.worker.autoreload.Autoreloader import on_init [as 别名]
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)
示例2: test_register_with_event_loop
# 需要导入模块: from celery.worker.autoreload import Autoreloader [as 别名]
# 或者: from celery.worker.autoreload.Autoreloader import on_init [as 别名]
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)