Exemplo n.º 1
0
    def check_device_connected(self):
        """Checks that device shows up as a connection on the host machine.

    Raises:
       DeviceNotConnectedError: if device is not connected.
    """
        device_config = {"persistent": self.props["persistent_identifiers"]}
        try:
            common_utils.retry(func=self.is_connected,
                               func_args=(device_config, ),
                               is_successful=bool,
                               timeout=self.timeouts["CONNECTED"])
        except errors.CommunicationTimeoutError:
            raise errors.DeviceNotConnectedError(
                self.name, msg="device not reachable from host machine.")
Exemplo n.º 2
0
  def check_device_connected(self):
    """Checks that device shows up as a connection on the host machine.

    Raises:
        DeviceNotConnectedError: if device is not connected.
    """
    logger.info("{} waiting up to {}s for device to be connected.".format(
        self.name, self.timeouts["CONNECTED"]))
    end_time = time.time() + self.timeouts["CONNECTED"]
    while time.time() < end_time:
      if self.connected:  # pylint: disable=using-constant-test
        return
      time.sleep(.5)
    raise errors.DeviceNotConnectedError(
        self.name, msg="device not reachable from host machine.")
Exemplo n.º 3
0
 def test_device_not_connected_error_error_except_with_error_code(self):
     """Verifies correct error code for DeviceNotConnectedError."""
     error = _raise_and_catch(
         errors.DeviceNotConnectedError("device-1234", "test"))
     self.assertEqual(error.err_code, 31)