本文整理汇总了Python中easyprocess.EasyProcess.wait方法的典型用法代码示例。如果您正苦于以下问题:Python EasyProcess.wait方法的具体用法?Python EasyProcess.wait怎么用?Python EasyProcess.wait使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类easyprocess.EasyProcess
的用法示例。
在下文中一共展示了EasyProcess.wait方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_buttons
# 需要导入模块: from easyprocess import EasyProcess [as 别名]
# 或者: from easyprocess.EasyProcess import wait [as 别名]
def check_buttons(cmd, expect):
with SmartDisplay(visible=VISIBLE) as disp:
with EasyProcess(cmd):
disp.waitgrab(timeout=TIMEOUT)
buttons = discover_buttons()
eq_(len(buttons), len(expect),
msg='dialog does not have expected buttons %s!=%s' % (buttons,expect))
mouse = PyMouse()
print 'buttons:',buttons
for v, b in zip(expect, buttons):
process = EasyProcess(cmd).start().sleep(1)
mouse.click(*b.center)
process.wait()
eq_(process.stdout, str(v)) #dialog does not return expected value
示例2: test_timeout
# 需要导入模块: from easyprocess import EasyProcess [as 别名]
# 或者: from easyprocess.EasyProcess import wait [as 别名]
def test_timeout(self):
p = EasyProcess('sleep 1').start()
p.wait(0.2)
eq_(p.is_alive(), True)
p.wait(0.2)
eq_(p.is_alive(), True)
p.wait(2)
eq_(p.is_alive(), False)
eq_(EasyProcess('sleep 0.3').call().return_code == 0, True)
eq_(EasyProcess('sleep 0.3').call(timeout=0.1).return_code == 0, False)
eq_(EasyProcess('sleep 0.3').call(timeout=1).return_code == 0, True)
eq_(EasyProcess('sleep 0.3').call().timeout_happened, False)
eq_(EasyProcess('sleep 0.3').call(timeout=0.1).timeout_happened, True)
eq_(EasyProcess('sleep 0.3').call(timeout=1).timeout_happened, False)