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


Python AutomatorServer.adb方法代码示例

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


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

示例1: test_start_ping

# 需要导入模块: from uiautomator import AutomatorServer [as 别名]
# 或者: from uiautomator.AutomatorServer import adb [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_push

# 需要导入模块: from uiautomator import AutomatorServer [as 别名]
# 或者: from uiautomator.AutomatorServer import adb [as 别名]
 def test_push(self):
     jars = ["bundle.jar", "uiautomator-stub.jar"]
     server = AutomatorServer()
     server.adb = MagicMock()
     self.assertEqual(set(server.push()), set(jars))
     for args in server.adb.cmd.call_args_list:
         self.assertEqual(args[0][0], "push")
         self.assertEqual(args[0][2], "/data/local/tmp/")
开发者ID:Infinity2013,项目名称:ux-script,代码行数:10,代码来源:test_server.py

示例3: test_start_success

# 需要导入模块: from uiautomator import AutomatorServer [as 别名]
# 或者: from uiautomator.AutomatorServer import adb [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

示例4: test_start_error

# 需要导入模块: from uiautomator import AutomatorServer [as 别名]
# 或者: from uiautomator.AutomatorServer import adb [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

示例5: test_download_and_push_download

# 需要导入模块: from uiautomator import AutomatorServer [as 别名]
# 或者: from uiautomator.AutomatorServer import adb [as 别名]
 def test_download_and_push_download(self):
     jars = ["bundle.jar", "uiautomator-stub.jar"]
     with patch("os.path.exists") as exists:
         with patch("os.mkdir") as mkdir:
             with patch("%s.open" % open.__class__.__module__, mock_open(), create=True) as m_open:
                 server = AutomatorServer()
                 server.adb = MagicMock()
                 exists.return_value = False
                 self.assertEqual(set(server.download_and_push()), set(jars))
                 self.assertEqual(len(m_open.call_args_list), len(jars))
开发者ID:ashim888,项目名称:uiautomator,代码行数:12,代码来源:test_server.py

示例6: test_download_and_push

# 需要导入模块: from uiautomator import AutomatorServer [as 别名]
# 或者: from uiautomator.AutomatorServer import adb [as 别名]
 def test_download_and_push(self):
     jars = ["bundle.jar", "uiautomator-stub.jar"]
     with patch("os.path.exists") as exists:
         with patch("os.stat") as stat:
             server = AutomatorServer()
             server.adb = MagicMock()
             exists.return_value = True
             stat.st_size = 1024
             self.assertEqual(set(server.download_and_push()), set(jars))
             for args in server.adb.cmd.call_args_list:
                 self.assertEqual(args[0][0], "push")
                 self.assertEqual(args[0][2], "/data/local/tmp/")
开发者ID:ashim888,项目名称:uiautomator,代码行数:14,代码来源:test_server.py

示例7: test_stop_started_server

# 需要导入模块: from uiautomator import AutomatorServer [as 别名]
# 或者: from uiautomator.AutomatorServer import adb [as 别名]
    def test_stop_started_server(self):
        server = AutomatorServer()
        server.adb = MagicMock()
        server.uiautomator_process = process = MagicMock()
        process.poll.return_value = None
        server.stop()
        process.wait.assert_called_once_with()

        server.uiautomator_process = process = MagicMock()
        process.poll.return_value = None
        self.urlopen.side_effect = IOError("error")
        server.stop()
        process.kill.assert_called_once_with()
开发者ID:Infinity2013,项目名称:ux-script,代码行数:15,代码来源:test_server.py

示例8: test_stop

# 需要导入模块: from uiautomator import AutomatorServer [as 别名]
# 或者: from uiautomator.AutomatorServer import adb [as 别名]
 def test_stop(self):
     results = [
         b"USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME\n\rsystem    372   126   635596 104808 ffffffff 00000000 S uiautomator",
         b"USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME\r\nsystem    372   126   635596 104808 ffffffff 00000000 S uiautomator",
         b"USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME\nsystem    372   126   635596 104808 ffffffff 00000000 S uiautomator",
         b"USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME\rsystem    372   126   635596 104808 ffffffff 00000000 S uiautomator"
     ]
     for r in results:
         server = AutomatorServer()
         server.adb = MagicMock()
         server.adb.cmd.return_value.communicate.return_value = (r, "")
         server.stop()
         self.assertEqual(server.adb.cmd.call_args_list,
                          [call("shell", "ps", "-C", "uiautomator"), call("shell", "kill", "-9", "372")])
开发者ID:Infinity2013,项目名称:ux-script,代码行数:16,代码来源:test_server.py


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