本文整理汇总了Python中supervisor.tests.base.DummyOptions.select_result方法的典型用法代码示例。如果您正苦于以下问题:Python DummyOptions.select_result方法的具体用法?Python DummyOptions.select_result怎么用?Python DummyOptions.select_result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类supervisor.tests.base.DummyOptions
的用法示例。
在下文中一共展示了DummyOptions.select_result方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_runforever_select_dispatcher_exitnow
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import select_result [as 别名]
def test_runforever_select_dispatcher_exitnow(self):
options = DummyOptions()
supervisord = self._makeOne(options)
pconfig = DummyPConfig(options, 'foo', '/bin/foo',)
gconfig = DummyPGroupConfig(options, pconfigs=[pconfig])
pgroup = DummyProcessGroup(gconfig)
from supervisor.medusa import asyncore_25 as asyncore
exitnow = DummyDispatcher(readable=True, error=asyncore.ExitNow)
pgroup.dispatchers = {6:exitnow}
supervisord.process_groups = {'foo': pgroup}
options.select_result = [6], [], []
options.test = True
self.assertRaises(asyncore.ExitNow, supervisord.runforever)
示例2: test_runforever_select_dispatchers
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import select_result [as 别名]
def test_runforever_select_dispatchers(self):
options = DummyOptions()
supervisord = self._makeOne(options)
pconfig = DummyPConfig(options, 'foo', '/bin/foo',)
gconfig = DummyPGroupConfig(options, pconfigs=[pconfig])
pgroup = DummyProcessGroup(gconfig)
readable = DummyDispatcher(readable=True)
writable = DummyDispatcher(writable=True)
error = DummyDispatcher(writable=True, error=OSError)
pgroup.dispatchers = {6:readable, 7:writable, 8:error}
supervisord.process_groups = {'foo': pgroup}
options.select_result = [6], [7, 8], []
options.test = True
supervisord.runforever()
self.assertEqual(pgroup.transitioned, True)
self.assertEqual(readable.read_event_handled, True)
self.assertEqual(writable.write_event_handled, True)
self.assertEqual(error.error_handled, True)