本文整理汇总了Python中diesel.Application.halt方法的典型用法代码示例。如果您正苦于以下问题:Python Application.halt方法的具体用法?Python Application.halt怎么用?Python Application.halt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类diesel.Application
的用法示例。
在下文中一共展示了Application.halt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DieselTest
# 需要导入模块: from diesel import Application [as 别名]
# 或者: from diesel.Application import halt [as 别名]
class DieselTest(object):
def setup_method(self, *args):
self._app = Application(allow_app_replacement=True)
self._trigger = TestTrigger()
# XXX py.test magic args?
def prepare_test(self):
return self._app, self._trigger.touch, TestAccumulator()
def run_test(self, count=1, timeout=10):
def trigger_thread():
self._trigger.wait(timeout, count)
try:
self._app.halt()
except app.ApplicationEnd:
# XXX Does halt have to raise this? Should we do anything but
# pass?
pass
self._app.hub.wake_from_other_thread()
thread.start_new_thread(trigger_thread, ())
self._app.run()
if self._trigger.timed_out:
raise TestTimeout()
def teardown_method(self, *args):
try:
self._app.halt()
except app.ApplicationEnd:
# This is always raised?
pass
self._app = self._trigger = None
示例2: DieselTest
# 需要导入模块: from diesel import Application [as 别名]
# 或者: from diesel.Application import halt [as 别名]
class DieselTest(object):
def setup_method(self, *args):
self._app = Application(allow_app_replacement=True)
self._trigger = TestTrigger()
# XXX py.test magic args?
def prepare_test(self):
return self._app, self._trigger.touch, TestAccumulator()
def run_test(self, count=1, timeout=10):
def trigger_thread():
self._trigger.wait(timeout, count)
self._app.halt()
self._app.hub.wake_from_other_thread()
thread.start_new_thread(trigger_thread, ())
self._app.run()
if self._trigger.timed_out:
raise TestTimeout()
def teardown_method(self, *args):
self._app.halt()
self._app = self._trigger = None