def _CheckPortStatus(port, expected_status): """Returns True if port has expected_status. Args: port: the port number. expected_status: boolean of expected status. Returns: Returns True if the status is expected. Otherwise returns False. """ return _WaitUntil(lambda: ports.IsHostPortUsed(port) == expected_status)
def _CheckPortStatus(port, expected_status): """Returns True if port has expected_status. Args: port: the port number. expected_status: boolean of expected status. Returns: Returns True if the status is expected. Otherwise returns False. """ for timeout in range(1, 5): if ports.IsHostPortUsed(port) == expected_status: return True time.sleep(timeout) return False