1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
from pathlib import Path
import pytest
@pytest.mark.parametrize(
"cmdline, overrides",
[
([], {}),
(["-Q", "license=MIT"], {"license": "MIT"}),
(
["-Q", "license=MIT", "-Q", "bootstrap=Toga"],
{"license": "MIT", "bootstrap": "Toga"},
),
],
)
def test_convert_app(convert_command, cmdline, overrides, patch_tempdir):
"""An application can be set up for briefcase created."""
(convert_command.base_path / "app_name").mkdir()
(convert_command.base_path / "pyproject.toml").write_text("", encoding="utf-8")
(convert_command.base_path / "app_name/__main__.py").write_text(
"", encoding="utf-8"
)
# Configure no command line options
options, _ = convert_command.parse_options(cmdline)
# Run the run command
convert_command(**options)
# The right sequence of things will be done
assert convert_command.actions == [
# Host OS is verified
("verify-host",),
# Tools are verified
("verify-tools",),
# Pyproject doesn't contain Briefcase config
("validate-pyproject-file",),
# Run the first app
(
"new",
{
"template": None,
"template_branch": None,
"project_overrides": overrides,
"tmp_path": Path(patch_tempdir.name),
},
),
]
|