本文整理汇总了Python中supervisor.tests.base.DummyOptions.test方法的典型用法代码示例。如果您正苦于以下问题:Python DummyOptions.test方法的具体用法?Python DummyOptions.test怎么用?Python DummyOptions.test使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类supervisor.tests.base.DummyOptions
的用法示例。
在下文中一共展示了DummyOptions.test方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_main_first
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import test [as 别名]
def test_main_first(self):
options = DummyOptions()
pconfig = DummyPConfig(options, 'foo', 'foo', '/bin/foo')
gconfigs = [DummyPGroupConfig(options,'foo', pconfigs=[pconfig])]
options.process_group_configs = gconfigs
options.test = True
options.first = True
supervisord = self._makeOne(options)
supervisord.main()
self.assertEqual(options.environment_processed, True)
self.assertEqual(options.fds_cleaned_up, False)
self.assertEqual(options.rlimits_set, True)
self.assertEqual(options.parse_criticals, ['setuid_called'])
self.assertEqual(options.parse_warnings, [])
self.assertEqual(options.parse_infos, ['rlimits_set'])
self.assertEqual(options.autochildlogdir_cleared, True)
self.assertEqual(len(supervisord.process_groups), 1)
self.assertEqual(supervisord.process_groups['foo'].config.options,
options)
self.assertEqual(options.environment_processed, True)
self.assertEqual(options.httpservers_opened, True)
self.assertEqual(options.signals_set, True)
self.assertEqual(options.daemonized, True)
self.assertEqual(options.pidfile_written, True)
self.assertEqual(options.cleaned_up, True)
示例2: test_runforever_calls_tick
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import test [as 别名]
def test_runforever_calls_tick(self):
options = DummyOptions()
options.test = True
supervisord = self._makeOne(options)
self.assertEqual(len(supervisord.ticks), 0)
supervisord.runforever()
self.assertEqual(len(supervisord.ticks), 3)
示例3: test_runforever_select_uncaught_exception
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import test [as 别名]
def test_runforever_select_uncaught_exception(self):
options = DummyOptions()
import errno
options.select_error = errno.EBADF
supervisord = self._makeOne(options)
import select
options.test = True
self.assertRaises(select.error, supervisord.runforever)
示例4: test_runforever_select_eintr
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import test [as 别名]
def test_runforever_select_eintr(self):
options = DummyOptions()
import errno
options.select_error = errno.EINTR
supervisord = self._makeOne(options)
options.test = True
supervisord.runforever()
self.assertEqual(options.logger.data[0], 'EINTR encountered in select')
示例5: test_runforever_emits_generic_specific_event
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import test [as 别名]
def test_runforever_emits_generic_specific_event(self):
from supervisor import events
L = []
def callback(event):
L.append(2)
events.subscribe(events.SupervisorRunningEvent, callback)
options = DummyOptions()
options.test = True
supervisord = self._makeOne(options)
supervisord.runforever()
self.assertEqual(L, [2])
示例6: test_runforever_emits_generic_startup_event
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import test [as 别名]
def test_runforever_emits_generic_startup_event(self):
from supervisor import events
L = []
def callback(event):
L.append(1)
events.subscribe(events.SupervisorStateChangeEvent, callback)
options = DummyOptions()
supervisord = self._makeOne(options)
options.test = True
supervisord.runforever()
self.assertEqual(L, [1])
示例7: test_runforever_select_dispatcher_exitnow
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import test [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)
示例8: test_runforever_select_dispatcher_handle_error_via_write
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import test [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)
示例9: test_add_process_group_event
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import test [as 别名]
def test_add_process_group_event(self):
from supervisor import events
L = []
def callback(event):
L.append(1)
events.subscribe(events.ProcessGroupAddedEvent, callback)
options = DummyOptions()
pconfig = DummyPConfig(options, 'foo', 'foo', '/bin/foo')
gconfig = DummyPGroupConfig(options,'foo', pconfigs=[pconfig])
options.process_group_configs = [gconfig]
supervisord = self._makeOne(options)
supervisord.add_process_group(gconfig)
options.test = True
supervisord.runforever()
self.assertEqual(L, [1])
示例10: test_runforever_select_dispatchers
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import test [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)
示例11: test_runforever_stopping_emits_events
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import test [as 别名]
def test_runforever_stopping_emits_events(self):
options = DummyOptions()
supervisord = self._makeOne(options)
gconfig = DummyPGroupConfig(options)
pgroup = DummyProcessGroup(gconfig)
supervisord.process_groups = {'foo': pgroup}
supervisord.options.mood = -1
L = []
def callback(event):
L.append(event)
from supervisor import events
events.subscribe(events.SupervisorStateChangeEvent, callback)
from supervisor.medusa import asyncore_25 as asyncore
options.test = True
self.assertRaises(asyncore.ExitNow, supervisord.runforever)
self.assertTrue(pgroup.all_stopped)
self.assertTrue(isinstance(L[0], events.SupervisorRunningEvent))
self.assertTrue(isinstance(L[0], events.SupervisorStateChangeEvent))
self.assertTrue(isinstance(L[1], events.SupervisorStoppingEvent))
self.assertTrue(isinstance(L[1], events.SupervisorStateChangeEvent))
示例12: test_main_notfirst
# 需要导入模块: from supervisor.tests.base import DummyOptions [as 别名]
# 或者: from supervisor.tests.base.DummyOptions import test [as 别名]
def test_main_notfirst(self):
options = DummyOptions()
pconfig = DummyPConfig(options, 'foo', 'foo', '/bin/foo')
gconfigs = [DummyPGroupConfig(options,'foo', pconfigs=[pconfig])]
options.process_group_configs = gconfigs
options.test = True
options.first = False
supervisord = self._makeOne(options)
supervisord.main()
self.assertEqual(options.environment_processed, True)
self.assertEqual(options.fds_cleaned_up, True)
self.assertFalse(hasattr(options, 'rlimits_set'))
self.assertEqual(options.make_logger_messages,
(['setuid_called'], [], []))
self.assertEqual(options.autochildlogdir_cleared, True)
self.assertEqual(len(supervisord.process_groups), 1)
self.assertEqual(supervisord.process_groups['foo'].config.options,
options)
self.assertEqual(options.environment_processed, True)
self.assertEqual(options.httpservers_opened, True)
self.assertEqual(options.signals_set, True)
self.assertEqual(options.daemonized, False)
self.assertEqual(options.pidfile_written, True)
self.assertEqual(options.cleaned_up, True)