How to use the briefcase.cmdline.parse_cmdline 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 / test_cmdline.py View on Github external
def test_new_command():
    "``briefcase new`` returns the New command"
    cmd, options = parse_cmdline('new'.split())

    assert isinstance(cmd, NewCommand)
    assert cmd.platform == 'all'
    assert cmd.output_format is None
    assert options == {'template': None, 'verbosity': 1}
github beeware / briefcase / tests / test_cmdline.py View on Github external
def test_command_explicit_format(monkeypatch):
    "``briefcase create macOS dmg`` returns the macOS create dmg command"
    # Pretend we're on macOS, regardless of where the tests run.
    monkeypatch.setattr(sys, 'platform', 'darwin')

    cmd, options = parse_cmdline('create macOS dmg'.split())

    assert isinstance(cmd, macOSDmgCreateCommand)
    assert cmd.platform == 'macOS'
    assert cmd.output_format == 'dmg'
    assert options == {'verbosity': 1}
github beeware / briefcase / tests / test_cmdline.py View on Github external
def test_bare_command(monkeypatch):
    "``briefcase create`` returns the macOS create app command"
    # Pretend we're on macOS, regardless of where the tests run.
    monkeypatch.setattr(sys, 'platform', 'darwin')

    cmd, options = parse_cmdline('create'.split())

    assert isinstance(cmd, macOSAppCreateCommand)
    assert cmd.platform == 'macOS'
    assert cmd.output_format == 'dmg'
    assert options == {'verbosity': 1}
github beeware / briefcase / tests / test_cmdline.py View on Github external
def test_unknown_command_options(monkeypatch, capsys):
    "Commands can provide their own arguments"
    # Pretend we're on macOS, regardless of where the tests run.
    monkeypatch.setattr(sys, 'platform', 'darwin')

    # Invoke a command but provide an option. that isn't defined
    with pytest.raises(SystemExit) as excinfo:
        parse_cmdline('publish macOS app -x foobar'.split())

    # Normal exit due to displaying help
    assert excinfo.value.code == 2
    # Help message is for default platform and format
    output = capsys.readouterr().err

    assert output.startswith(
        "usage: briefcase publish macOS app [-h] [-v] [-V] [-c {s3}]\n"
        "briefcase publish macOS app: error: unrecognized arguments: -x"
github beeware / briefcase / tests / test_cmdline.py View on Github external
def test_windows_default():
    "``briefcase create`` returns the Windows create msi command on Windows"

    cmd, options = parse_cmdline('create'.split())

    assert isinstance(cmd, WindowsMSICreateCommand)
    assert cmd.platform == 'windows'
    assert cmd.output_format == 'msi'
    assert options == {'verbosity': 1}
github beeware / briefcase / tests / test_cmdline.py View on Github external
def test_command_explicit_platform(monkeypatch):
    "``briefcase create linux`` returns linux create app command"
    # Pretend we're on macOS, regardless of where the tests run.
    monkeypatch.setattr(sys, 'platform', 'darwin')

    cmd, options = parse_cmdline('create linux'.split())

    assert isinstance(cmd, LinuxAppImageCreateCommand)
    assert cmd.platform == 'linux'
    assert cmd.output_format == 'appimage'
    assert options == {'verbosity': 1}
github beeware / briefcase / tests / test_cmdline.py View on Github external
def test_linux_default():
    "``briefcase create`` returns the linux create appimage command on Linux"

    cmd, options = parse_cmdline('create'.split())

    assert isinstance(cmd, LinuxAppImageCreateCommand)
    assert cmd.platform == 'linux'
    assert cmd.output_format == 'appimage'
    assert options == {'verbosity': 1}
github beeware / briefcase / tests / test_cmdline.py View on Github external
def test_bare_command_show_formats(monkeypatch):
    "``briefcase create -f`` returns an error indicating a platform is needed"
    # Pretend we're on macOS, regardless of where the tests run.
    monkeypatch.setattr(sys, 'platform', 'darwin')

    with pytest.raises(ShowOutputFormats) as excinfo:
        parse_cmdline('create -f'.split())

    assert excinfo.value.platform == 'macOS'
    assert excinfo.value.default == 'dmg'
    assert set(excinfo.value.choices) == {'app', 'dmg', 'homebrew'}
github beeware / briefcase / tests / test_cmdline.py View on Github external
def test_command_explicit_format_show_formats(monkeypatch):
    "``briefcase create macOS dmg -f`` shows formats for the platform"
    # Pretend we're on macOS, regardless of where the tests run.
    monkeypatch.setattr(sys, 'platform', 'darwin')

    with pytest.raises(ShowOutputFormats) as excinfo:
        parse_cmdline('create macOS dmg -f'.split())

    assert excinfo.value.platform == 'macOS'
    assert excinfo.value.default == 'dmg'
    assert set(excinfo.value.choices) == {'app', 'dmg', 'homebrew'}
github beeware / briefcase / tests / test_cmdline.py View on Github external
def test_command_unknown_platform(monkeypatch):
    "``briefcase create foobar`` raises an unknown platform error"
    # Pretend we're on macOS, regardless of where the tests run.
    monkeypatch.setattr(sys, 'platform', 'darwin')

    with pytest.raises(SystemExit) as excinfo:
        parse_cmdline('create foobar'.split())

    assert excinfo.value.code == 2
    assert excinfo.value.__context__.argument_name == 'platform'
    assert excinfo.value.__context__.message.startswith("invalid choice: 'foobar' (choose from")