當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。