def wait_until_device_is_booted(udid, timeout_seconds=60 * 5): with timeout(seconds=timeout_seconds): while True: state = subprocess.check_output(['xcrun', 'simctl', 'spawn', udid, 'launchctl', 'print', 'system']).strip() if re.search("A[\s]+com.apple.springboard.services", state): return time.sleep(1)
def wait_until_device_is_booted(udid, timeout_seconds=60 * 15): Simulator.wait_until_device_is_in_state(udid, Simulator.DeviceState.BOOTED, timeout_seconds) with timeout(seconds=timeout_seconds): while True: try: state = subprocess.check_output([ 'xcrun', 'simctl', 'spawn', udid, 'launchctl', 'print', 'system' ]).strip() _log.debug('xcrun simctl spawn %s', udid) if re.search("A[\s]+com.apple.springboard.services", state): return except subprocess.CalledProcessError: if Simulator.device_state( udid) != Simulator.DeviceState.BOOTED: raise RuntimeError( 'Simuator device quit unexpectedly.') _log.warn( "Error in checking Simulator boot status. Will retry in 1 second." ) time.sleep(1)
def wait_until_device_is_booted(udid, timeout_seconds=60 * 5): Simulator.wait_until_device_is_in_state(udid, Simulator.DeviceState.BOOTED, timeout_seconds) with timeout(seconds=timeout_seconds): while True: try: state = subprocess.check_output(['xcrun', 'simctl', 'spawn', udid, 'launchctl', 'print', 'system']).strip() if re.search("A[\s]+com.apple.springboard.services", state): return except subprocess.CalledProcessError: _log.warn("Error in checking Simulator boot status.") time.sleep(1)
def wait_until_device_is_in_state(udid, wait_until_state, timeout_seconds=60 * 5): _log.debug('waiting for device %s to enter state %s with timeout %s', udid, Simulator.device_state_description(wait_until_state), timeout_seconds) with timeout(seconds=timeout_seconds): device_state = Simulator.device_state(udid) while (device_state != wait_until_state): device_state = Simulator.device_state(udid) _log.debug(' device state %s', Simulator.device_state_description(device_state)) time.sleep(0.5) end_state = Simulator.device_state(udid) if (end_state != wait_until_state): raise RuntimeError('Timed out waiting for simulator device to enter state {0}; current state is {1}'.format(Simulator.device_state_description(wait_until_state), Simulator.device_state_description(end_state)))
def wait_until_device_is_booted(udid, timeout_seconds=60 * 5): Simulator.wait_until_device_is_in_state(udid, Simulator.DeviceState.BOOTED, timeout_seconds) with timeout(seconds=timeout_seconds): while True: try: state = subprocess.check_output(['xcrun', 'simctl', 'spawn', udid, 'launchctl', 'print', 'system']).strip() _log.debug('xcrun simctl spawn %s', udid) if re.search("A[\s]+com.apple.springboard.services", state): return except subprocess.CalledProcessError: if Simulator.device_state(udid) != Simulator.DeviceState.BOOTED: raise RuntimeError('Simuator device quit unexpectedly.') _log.warn("Error in checking Simulator boot status. Will retry in 1 second.") time.sleep(1)
def wait_until_device_is_in_state(udid, wait_until_state, timeout_seconds=60 * 5): with timeout(seconds=timeout_seconds): while Simulator.device_state(udid) != wait_until_state: time.sleep(0.5)
def wait_until_device_is_in_state(udid, wait_until_state, timeout_seconds=60 * 5): with timeout(seconds=timeout_seconds): while (Simulator.device_state(udid) != wait_until_state): time.sleep(0.5)