本文整理汇总了Python中celery.worker.autoreload.KQueueMonitor.add_events方法的典型用法代码示例。如果您正苦于以下问题:Python KQueueMonitor.add_events方法的具体用法?Python KQueueMonitor.add_events怎么用?Python KQueueMonitor.add_events使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类celery.worker.autoreload.KQueueMonitor
的用法示例。
在下文中一共展示了KQueueMonitor.add_events方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_on_poll_init
# 需要导入模块: from celery.worker.autoreload import KQueueMonitor [as 别名]
# 或者: from celery.worker.autoreload.KQueueMonitor import add_events [as 别名]
def test_on_poll_init(self):
x = KQueueMonitor(['a', 'b'])
hub = Mock()
x.add_events = Mock()
x.on_poll_init(hub)
x.add_events.assert_called_with(hub.poller)
self.assertEqual(
hub.poller.on_file_change,
x.handle_event,
)
示例2: test_register_with_event_loop
# 需要导入模块: from celery.worker.autoreload import KQueueMonitor [as 别名]
# 或者: from celery.worker.autoreload.KQueueMonitor import add_events [as 别名]
def test_register_with_event_loop(self, kqueue):
x = KQueueMonitor(['a', 'b'])
hub = Mock(name='hub')
x.add_events = Mock(name='add_events()')
x.register_with_event_loop(hub)
x.add_events.assert_called_with(x._kq)
self.assertEqual(
x._kq.on_file_change,
x.handle_event,
)
示例3: test_register_with_event_loop
# 需要导入模块: from celery.worker.autoreload import KQueueMonitor [as 别名]
# 或者: from celery.worker.autoreload.KQueueMonitor import add_events [as 别名]
def test_register_with_event_loop(self):
x = KQueueMonitor(['a', 'b'])
hub = Mock()
x.add_events = Mock()
x.register_with_event_loop(hub)
x.add_events.assert_called_with(hub.poller)
self.assertEqual(
hub.poller.on_file_change,
x.handle_event,
)
示例4: test_register_with_event_loop
# 需要导入模块: from celery.worker.autoreload import KQueueMonitor [as 别名]
# 或者: from celery.worker.autoreload.KQueueMonitor import add_events [as 别名]
def test_register_with_event_loop(self):
from kombu.utils import eventio
if eventio.kqueue is None:
raise SkipTest('version of kombu does not work with pypy')
x = KQueueMonitor(['a', 'b'])
hub = Mock(name='hub')
x.add_events = Mock(name='add_events()')
x.register_with_event_loop(hub)
x.add_events.assert_called_with(x._kq)
self.assertEqual(
x._kq.on_file_change,
x.handle_event,
)