How to use the briefcase.integrations.xcode.get_device_state function in briefcase

To help you get started, we’ve selected a few briefcase examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github beeware / briefcase / tests / integrations / xcode / test_get_device_state.py View on Github external
def test_known_device_shutdown():
    "A valid, shut down device can be inspected"
    sub = mock.MagicMock()
    sub.check_output.return_value = simctl_result('single-device-shutdown')

    state = get_device_state('2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D', sub=sub)

    assert state == DeviceState.SHUTDOWN
github beeware / briefcase / tests / integrations / xcode / test_get_device_state.py View on Github external
def test_unknown_device():
    "If you ask for an invalid device UDID, an exception is raised."
    sub = mock.MagicMock()
    sub.check_output.return_value = simctl_result('no-devices')

    with pytest.raises(BriefcaseCommandError):
        get_device_state('dead-beef-dead-beef', sub=sub)
github beeware / briefcase / tests / integrations / xcode / test_get_device_state.py View on Github external
def test_known_device_booted():
    "A valid, booted device can be inspected"
    sub = mock.MagicMock()
    sub.check_output.return_value = simctl_result('single-device-booted')

    state = get_device_state('2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D', sub=sub)

    assert state == DeviceState.BOOTED
github beeware / briefcase / tests / integrations / xcode / test_get_device_state.py View on Github external
def test_known_device_unknown_status():
    "If simctl returns something unexpected as status, we can recover"
    sub = mock.MagicMock()
    sub.check_output.return_value = simctl_result('single-device-unknown')

    state = get_device_state('2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D', sub=sub)

    assert state == DeviceState.UNKNOWN
github beeware / briefcase / tests / integrations / xcode / test_get_device_state.py View on Github external
def test_known_device_shutting_down():
    "A valid device that is shutting down can be inspected"
    sub = mock.MagicMock()
    sub.check_output.return_value = simctl_result('single-device-shutting-down')

    state = get_device_state('2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D', sub=sub)

    assert state == DeviceState.SHUTTING_DOWN
github beeware / briefcase / tests / integrations / xcode / test_get_device_state.py View on Github external
def test_simctl_missing():
    "If simctl is missing or fails to start, an exception is raised."
    sub = mock.MagicMock()
    sub.check_output.side_effect = subprocess.CalledProcessError(
        cmd=['xcrun', 'simctl', 'list', '-j'],
        returncode=1
    )

    with pytest.raises(BriefcaseCommandError):
        get_device_state('2D3503A3-6EB9-4B37-9B17-C7EFEF2FA32D', sub=sub)
github beeware / briefcase / src / briefcase / platforms / iOS / xcode.py View on Github external
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # External service APIs.
        # These are abstracted to enable testing without patching.
        self.get_device_state = get_device_state
        self.sleep = time.sleep