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