本文整理汇总了Python中supervisor.tests.base.DummyOptions类的典型用法代码示例。如果您正苦于以下问题:Python DummyOptions类的具体用法?Python DummyOptions怎么用?Python DummyOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DummyOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_runforever_calls_tick
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)
示例2: test_main_first
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)
示例3: test_runforever_select_uncaught_exception
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_handle_read_event
def test_handle_read_event(self):
options = DummyOptions()
options.readfd_result = "abc"
config = DummyPConfig(options, "process1", "/bin/process1", stdout_capture_maxbytes=100)
process = DummyProcess(config)
dispatcher = self._makeOne(process)
self.assertEqual(dispatcher.handle_read_event(), None)
self.assertEqual(dispatcher.output_buffer, "abc")
示例5: test_runforever_select_eintr
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')
示例6: test_handle_sigint
def test_handle_sigint(self):
options = DummyOptions()
options._signal = signal.SIGINT
supervisord = self._makeOne(options)
supervisord.handle_signal()
self.assertEqual(supervisord.options.mood, SupervisorStates.SHUTDOWN)
self.assertEqual(options.logger.data[0],
'received SIGINT indicating exit request')
示例7: test_handle_unknown_signal
def test_handle_unknown_signal(self):
options = DummyOptions()
options._signal = signal.SIGUSR1
supervisord = self._makeOne(options)
supervisord.handle_signal()
self.assertEqual(supervisord.options.mood, 1)
self.assertEqual(options.logger.data[0],
'received SIGUSR1 indicating nothing')
示例8: test_handle_sigquit
def test_handle_sigquit(self):
options = DummyOptions()
options._signal = signal.SIGQUIT
supervisord = self._makeOne(options)
supervisord.handle_signal()
self.assertEqual(supervisord.options.mood, -1)
self.assertEqual(options.logger.data[0],
'received SIGQUIT indicating exit request')
示例9: test_handle_sigabrt
def test_handle_sigabrt(self):
options = DummyOptions()
options._signal = signal.SIGABRT
supervisord = self._makeOne(options)
supervisord.handle_signal()
self.assertEqual(supervisord.options.mood, SupervisorStates.RESTARTING)
self.assertEqual(options.logger.data[0],
'received SIGABRT indicating restart request')
示例10: test_handle_sighup
def test_handle_sighup(self):
options = DummyOptions()
options._signal = signal.SIGHUP
supervisord = self._makeOne(options)
supervisord.handle_signal()
self.assertEqual(supervisord.options.mood, 0)
self.assertEqual(options.logger.data[0],
'received SIGHUP indicating restart request')
示例11: test_handle_read_event_logging_childlog
def test_handle_read_event_logging_childlog(self):
options = DummyOptions()
options.readfd_result = "supercalifragilisticexpialidocious"
config = DummyPConfig(options, "process1", "/bin/process1", stdout_logfile="/tmp/foo")
process = DummyProcess(config)
dispatcher = self._makeOne(process)
self.assertEqual(dispatcher.handle_read_event(), None)
self.assertEqual(len(dispatcher.childlog.data), 1)
self.assertEqual(dispatcher.childlog.data[0], "supercalifragilisticexpialidocious")
示例12: test_handle_write_event_uncaught_raised
def test_handle_write_event_uncaught_raised(self):
options = DummyOptions()
config = DummyPConfig(options, 'test', '/test')
process = DummyProcess(config)
dispatcher = self._makeOne(process)
dispatcher.input_buffer = 'halloooo'
import errno
options.write_error = errno.EBADF
self.assertRaises(OSError, dispatcher.handle_write_event)
示例13: test_handle_read_event_logging_nologs
def test_handle_read_event_logging_nologs(self):
options = DummyOptions()
options.readfd_result = 'supercalifragilisticexpialidocious'
config = DummyPConfig(options, 'process1', '/bin/process1')
process = DummyProcess(config)
dispatcher = self._makeOne(process)
# just make sure there are no errors if a child logger doesnt
# exist
self.assertEqual(dispatcher.handle_read_event(), None)
self.assertEqual(dispatcher.childlog, None)
示例14: test_handle_write_event_over_os_limit
def test_handle_write_event_over_os_limit(self):
options = DummyOptions()
config = DummyPConfig(options, 'test', '/test')
process = DummyProcess(config)
dispatcher = self._makeOne(process)
options.write_accept = 1
dispatcher.input_buffer = 'a' * 50
dispatcher.handle_write_event()
self.assertEqual(len(dispatcher.input_buffer), 49)
self.assertEqual(options.written[0], 'a')
示例15: test_runforever_emits_generic_startup_event
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])