本文整理汇总了Python中celery.events.snapshot.Polaroid.timer方法的典型用法代码示例。如果您正苦于以下问题:Python Polaroid.timer方法的具体用法?Python Polaroid.timer怎么用?Python Polaroid.timer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类celery.events.snapshot.Polaroid
的用法示例。
在下文中一共展示了Polaroid.timer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_install_timers
# 需要导入模块: from celery.events.snapshot import Polaroid [as 别名]
# 或者: from celery.events.snapshot.Polaroid import timer [as 别名]
def test_install_timers(self):
x = Polaroid(self.state, app=self.app)
x.timer = timer
x.__exit__()
x.__enter__()
assert x.capture in MockTimer.installed
assert x.cleanup in MockTimer.installed
x._tref.cancel.assert_not_called()
x._ctref.cancel.assert_not_called()
x.__exit__()
x._tref.cancel.assert_called()
x._ctref.cancel.assert_called()
x._tref.assert_called()
x._ctref.assert_not_called()
示例2: test_install_timers
# 需要导入模块: from celery.events.snapshot import Polaroid [as 别名]
# 或者: from celery.events.snapshot.Polaroid import timer [as 别名]
def test_install_timers(self):
x = Polaroid(self.state, app=self.app)
x.timer = timer
x.__exit__()
x.__enter__()
self.assertIn(x.capture, MockTimer.installed)
self.assertIn(x.cleanup, MockTimer.installed)
self.assertTrue(x._tref.active)
self.assertTrue(x._ctref.active)
x.__exit__()
self.assertFalse(x._tref.active)
self.assertFalse(x._ctref.active)
self.assertTrue(x._tref.called)
self.assertFalse(x._ctref.called)