本文整理匯總了Python中marionette_driver.marionette.Marionette.raise_for_port方法的典型用法代碼示例。如果您正苦於以下問題:Python Marionette.raise_for_port方法的具體用法?Python Marionette.raise_for_port怎麽用?Python Marionette.raise_for_port使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類marionette_driver.marionette.Marionette
的用法示例。
在下文中一共展示了Marionette.raise_for_port方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_disable_enable_new_connections
# 需要導入模塊: from marionette_driver.marionette import Marionette [as 別名]
# 或者: from marionette_driver.marionette.Marionette import raise_for_port [as 別名]
def test_disable_enable_new_connections(self):
# Do not re-create socket if it already exists
self.marionette._send_message("acceptConnections", {"value": True})
try:
# Disabling new connections does not affect existing ones...
self.marionette._send_message("acceptConnections", {"value": False})
self.assertEqual(1, self.marionette.execute_script("return 1"))
# but only new connection attempts
marionette = Marionette(host=self.marionette.host, port=self.marionette.port)
self.assertRaises(socket.timeout, marionette.raise_for_port, timeout=1.0)
self.marionette._send_message("acceptConnections", {"value": True})
marionette.raise_for_port(timeout=10.0)
finally:
self.marionette._send_message("acceptConnections", {"value": True})