当前位置: 首页>>代码示例>>Python>>正文


Python AutomatorServer.ping方法代码示例

本文整理汇总了Python中uiautomator.AutomatorServer.ping方法的典型用法代码示例。如果您正苦于以下问题:Python AutomatorServer.ping方法的具体用法?Python AutomatorServer.ping怎么用?Python AutomatorServer.ping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在uiautomator.AutomatorServer的用法示例。


在下文中一共展示了AutomatorServer.ping方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_start_ping

# 需要导入模块: from uiautomator import AutomatorServer [as 别名]
# 或者: from uiautomator.AutomatorServer import ping [as 别名]
 def test_start_ping(self):
     with patch("uiautomator.JsonRPCClient") as JsonRPCClient:
         JsonRPCClient.return_value.ping.return_value = "pong"
         server = AutomatorServer()
         server.adb = MagicMock()
         server.adb.forward.return_value = 0
         self.assertEqual(server.ping(), "pong")
开发者ID:Infinity2013,项目名称:ux-script,代码行数:9,代码来源:test_server.py

示例2: test_start_success

# 需要导入模块: from uiautomator import AutomatorServer [as 别名]
# 或者: from uiautomator.AutomatorServer import ping [as 别名]
 def test_start_success(self):
     server = AutomatorServer()
     server.push = MagicMock()
     server.push.return_value = ["bundle.jar", "uiautomator-stub.jar"]
     server.ping = MagicMock()
     server.ping.return_value = "pong"
     server.adb = MagicMock()
     server.start()
     server.adb.cmd.assert_valled_onec_with('shell', 'uiautomator', 'runtest', 'bundle.jar', 'uiautomator-stub.jar', '-c', 'com.github.uiautomatorstub.Stub')
开发者ID:Infinity2013,项目名称:ux-script,代码行数:11,代码来源:test_server.py

示例3: test_start_error

# 需要导入模块: from uiautomator import AutomatorServer [as 别名]
# 或者: from uiautomator.AutomatorServer import ping [as 别名]
 def test_start_error(self):
     server = AutomatorServer()
     server.push = MagicMock()
     server.push.return_value = ["bundle.jar", "uiautomator-stub.jar"]
     server.ping = MagicMock()
     server.ping.return_value = None
     server.adb = MagicMock()
     with patch("time.sleep"):
         with self.assertRaises(IOError):
             server.start()
开发者ID:Infinity2013,项目名称:ux-script,代码行数:12,代码来源:test_server.py

示例4: test_start_success

# 需要导入模块: from uiautomator import AutomatorServer [as 别名]
# 或者: from uiautomator.AutomatorServer import ping [as 别名]
 def test_start_success(self):
     server = AutomatorServer()
     server.download_and_push = MagicMock()
     server.download_and_push.return_value = ["bundle.jar", "uiautomator-stub.jar"]
     server.ping = MagicMock()
     server.ping.return_value = "pong"
     with patch("uiautomator.adb") as adb:
         adb.forward.return_value = 0
         with patch.dict('os.environ', {'LOCAL_PORT': '9000', 'DEVICE_PORT': '9000'}):
             server.start()
             adb.cmd.assert_valled_onec_with('shell', 'uiautomator', 'runtest', 'bundle.jar', 'uiautomator-stub.jar', '-c', 'com.github.uiautomatorstub.Stub')
             adb.forward.assert_called_once_with(9000, 9000)
开发者ID:EthanGuo,项目名称:uiautomator,代码行数:14,代码来源:test_server.py

示例5: test_start_error

# 需要导入模块: from uiautomator import AutomatorServer [as 别名]
# 或者: from uiautomator.AutomatorServer import ping [as 别名]
 def test_start_error(self):
     server = AutomatorServer()
     server.download_and_push = MagicMock()
     server.download_and_push.return_value = ["bundle.jar", "uiautomator-stub.jar"]
     server.ping = MagicMock()
     server.ping.return_value = None
     with patch("uiautomator.adb") as adb:
         adb.forward.return_value = 0
         with patch.dict('os.environ', {'LOCAL_PORT': '9000', 'DEVICE_PORT': '9000'}):
             with patch("time.sleep"):
                 with self.assertRaises(IOError):
                     server.start()
             adb.forward.assert_called_once_with(9000, 9000)
开发者ID:EthanGuo,项目名称:uiautomator,代码行数:15,代码来源:test_server.py

示例6: test_start_ping_none

# 需要导入模块: from uiautomator import AutomatorServer [as 别名]
# 或者: from uiautomator.AutomatorServer import ping [as 别名]
 def test_start_ping_none(self):
     with patch("uiautomator.JsonRPCClient") as JsonRPCClient:
         JsonRPCClient.return_value.ping.side_effect = Exception("error")
         server = AutomatorServer()
         self.assertEqual(server.ping(), None)
开发者ID:Infinity2013,项目名称:ux-script,代码行数:7,代码来源:test_server.py

示例7: test_start_ping_none

# 需要导入模块: from uiautomator import AutomatorServer [as 别名]
# 或者: from uiautomator.AutomatorServer import ping [as 别名]
 def test_start_ping_none(self):
     with patch.dict('os.environ', {'LOCAL_PORT': '9000', 'DEVICE_PORT': '9000'}):
         with patch("uiautomator.JsonRPCClient") as JsonRPCClient:
             JsonRPCClient.return_value.ping.side_effect = Exception("error")
             server = AutomatorServer()
             self.assertEqual(server.ping(), None)
开发者ID:EthanGuo,项目名称:uiautomator,代码行数:8,代码来源:test_server.py

示例8: test_start_ping

# 需要导入模块: from uiautomator import AutomatorServer [as 别名]
# 或者: from uiautomator.AutomatorServer import ping [as 别名]
 def test_start_ping(self):
     with patch.dict('os.environ', {'LOCAL_PORT': '9000', 'DEVICE_PORT': '9000'}):
         with patch("uiautomator.JsonRPCClient") as JsonRPCClient:
             JsonRPCClient.return_value.ping.return_value = "pong"
             server = AutomatorServer()
             self.assertEqual(server.ping(), "pong")
开发者ID:EthanGuo,项目名称:uiautomator,代码行数:8,代码来源:test_server.py


注:本文中的uiautomator.AutomatorServer.ping方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。