Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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}
def test_command_explicit_platform_case_handling(monkeypatch):
"``briefcase create macOS`` returns macOS create app command"
# Pretend we're on macOS, regardless of where the tests run.
monkeypatch.setattr(sys, 'platform', 'darwin')
# This is all lower case; the command normalizes to macOS
cmd, options = parse_cmdline('create macOS'.split())
assert isinstance(cmd, macOSAppCreateCommand)
assert cmd.platform == 'macOS'
assert cmd.output_format == 'dmg'
assert options == {'verbosity': 1}
def test_distribution_path(first_app_config, tmp_path):
command = macOSAppCreateCommand(base_path=tmp_path)
distribution_path = command.distribution_path(first_app_config)
assert distribution_path == tmp_path / 'macOS' / 'First App' / 'First App.app'
def test_binary_path(first_app_config, tmp_path):
command = macOSAppCreateCommand(base_path=tmp_path)
binary_path = command.binary_path(first_app_config)
assert binary_path == tmp_path / 'macOS' / 'First App' / 'First App.app'
class macOSDmgMixin(macOSAppMixin):
output_format = 'dmg'
def distribution_path(self, app):
return self.platform_path / '{app.formal_name}-{app.version}.dmg'.format(app=app)
def verify_tools(self):
super().verify_tools()
if dmgbuild is None:
raise BriefcaseCommandError("""
A macOS DMG can only be created on macOS.
""")
class macOSDmgCreateCommand(macOSDmgMixin, macOSAppCreateCommand):
description = "Create and populate a macOS DMG."
@property
def app_template_url(self):
"The URL for a cookiecutter repository to use when creating apps"
return 'https://github.com/beeware/briefcase-{self.platform}-app-template.git'.format(
self=self
)
class macOSDmgUpdateCommand(macOSDmgMixin, macOSAppUpdateCommand):
description = "Update an existing macOS DMG."
class macOSDmgBuildCommand(macOSDmgMixin, macOSAppBuildCommand):
description = "Build a macOS DMG."