Ejemplo n.º 1
0
 def test_wait_for_device(self):
     """
     test wait-fot-device.
     """
     # wait 1 second
     def func():
         import time
         time.sleep(1)
         return ['', None]
     self.mock_obj.communicate = func
     self.mock_popen.return_value = self.mock_obj
     # test timeout is 0.1, should raise exception
     with self.assertRaises(Exception) as cm:
         ret = AdbWrapper.adb_wait_for_device(timeout=0.1)
     # test timeout is 10, should pass
     ret = AdbWrapper.adb_wait_for_device(timeout=10)
     self.assertTrue(ret, 'The result should be True.')
Ejemplo n.º 2
0
    def test_wait_for_device(self):
        """
        test wait-fot-device.
        """

        # wait 1 second
        def func():
            import time
            time.sleep(1)
            return ['', None]

        self.mock_obj.communicate = func
        self.mock_popen.return_value = self.mock_obj
        # test timeout is 0.1, should raise exception
        with self.assertRaises(Exception) as cm:
            ret = AdbWrapper.adb_wait_for_device(timeout=0.1)
        # test timeout is 10, should pass
        ret = AdbWrapper.adb_wait_for_device(timeout=10)
        self.assertTrue(ret, 'The result should be True.')