def test_builtin(tested_config, tmpdir): """Test if builtin config and reference config match""" with ChangeCwd(tmpdir.strpath): if '--all' in tested_config.cli_arguments: with pytest.raises(mkosi.MkosiParseException): args = mkosi.parse_args(tested_config.cli_arguments) else: args = mkosi.parse_args(tested_config.cli_arguments) assert tested_config == args
def test_builtin(tested_config: Any, tmpdir: Path) -> None: """Test if builtin config and reference config match""" with change_cwd(tmpdir): if "--all" in tested_config.cli_arguments: with pytest.raises(MkosiException): args = mkosi.parse_args(tested_config.cli_arguments) else: args = mkosi.parse_args(tested_config.cli_arguments) assert tested_config == args
def test_def_2(tested_config: Any, tmpdir: Path) -> None: """Generate the mkosi.default file plus another config file""" with change_cwd(tmpdir): tested_config.prepare_mkosi_default(tmpdir) tested_config.prepare_mkosi_default_d_2(tmpdir) args = mkosi.parse_args(tested_config.cli_arguments) assert tested_config == args
def test_verb_shell_cli_args5(tmpdir): with ChangeCwd(tmpdir.strpath): cmdline_ref = ['-pa-package', '-p', 'another-package', 'shell', 'python3 -foo -bar;', 'ls --inode'] args = mkosi.parse_args(cmdline_ref) assert args['default'].verb == 'shell' assert args['default'].packages == ['a-package', 'another-package'] assert args['default'].cmdline == cmdline_ref[4:]
def test_def_2(tested_config, tmpdir): """Generate the mkosi.default file plus another config file""" with ChangeCwd(tmpdir.strpath): tested_config.prepare_mkosi_default(tmpdir.strpath) tested_config.prepare_mkosi_default_d_2(tmpdir.strpath) args = mkosi.parse_args(tested_config.cli_arguments) assert tested_config == args
def test_verb_shell_cli_args5(tmpdir): with ChangeCwd(tmpdir.strpath): cmdline_ref = ["-pa-package", "-p", "another-package", "shell", "python3 -foo -bar;", "ls --inode"] args = mkosi.parse_args(cmdline_ref) assert args["default"].verb == "shell" assert args["default"].packages == ["a-package", "another-package"] assert args["default"].cmdline == cmdline_ref[4:]
def test_verb_boot_no_cli_args2(tmpdir): with ChangeCwd(tmpdir.strpath): cmdline_ref = ["-pa-package", "boot", "--par-for-sub", "--popenssl", "--for_sub", "1234"] args = mkosi.parse_args(cmdline_ref) assert args["default"].verb == "boot" assert "a-package" in args["default"].packages assert args["default"].cmdline == cmdline_ref[2:]
def test_verb_boot_no_cli_args2(tmpdir): with ChangeCwd(tmpdir.strpath): cmdline_ref = ['-pa-package', 'boot', '--par-for-sub', '--popenssl', '--for_sub', '1234'] args = mkosi.parse_args(cmdline_ref) assert args['default'].verb == 'boot' assert 'a-package' in args['default'].packages assert args['default'].cmdline == cmdline_ref[2:]
def test_def_1_args(tested_config, tmpdir): """Generate the mkosi.default plus a config file plus command line arguments""" with ChangeCwd(tmpdir.strpath): tested_config.prepare_mkosi_default(tmpdir.strpath) tested_config.prepare_mkosi_default_d_1(tmpdir.strpath) tested_config.prepare_args() args = mkosi.parse_args(tested_config.cli_arguments) assert tested_config == args
def test_def_1_args(tested_config: Any, tmpdir: Path) -> None: """Generate the mkosi.default plus a config file plus command line arguments""" with change_cwd(tmpdir): tested_config.prepare_mkosi_default(tmpdir) tested_config.prepare_mkosi_default_d_1(tmpdir) tested_config.prepare_args() args = mkosi.parse_args(tested_config.cli_arguments) assert tested_config == args
def test_verb_boot_no_cli_args2(tmpdir: Path) -> None: with change_cwd(tmpdir): cmdline_ref = [ "-pa-package", "boot", "--par-for-sub", "--popenssl", "--for_sub", "1234" ] args = mkosi.parse_args(cmdline_ref) assert args["default"].verb == Verb.boot assert "a-package" in args["default"].packages assert args["default"].cmdline == cmdline_ref[2:]
def test_verb_shell_cli_args5(tmpdir: Path) -> None: with change_cwd(tmpdir): cmdline_ref = [ "-pa-package", "-p", "another-package", "shell", "python3 -foo -bar;", "ls --inode" ] args = mkosi.parse_args(cmdline_ref) assert args["default"].verb == Verb.shell assert args["default"].packages == ["a-package", "another-package"] assert args["default"].cmdline == cmdline_ref[4:]
def test_verb_build(tmpdir): with ChangeCwd(tmpdir.strpath): args = mkosi.parse_args(["build"]) assert args["default"].verb == "build"
def test_verb_summary_no_cli_args4(tmpdir): with ChangeCwd(tmpdir.strpath): cmdline_ref = ['-pa-package', '-p', 'another-package', 'summary'] args = mkosi.parse_args(cmdline_ref) assert args['default'].verb == 'summary' assert args['default'].packages == ['a-package', 'another-package']
def test_verb_shell_cli_args7(tmpdir): with ChangeCwd(tmpdir.strpath): cmdline_ref = ['-i', 'summary'] args = mkosi.parse_args(cmdline_ref) assert args['default'].verb == 'summary' assert args['default'].incremental == True
def test_verb_build(tmpdir): with ChangeCwd(tmpdir.strpath): args = mkosi.parse_args(['build']) assert args['default'].verb == 'build'
def test_verb_boot_no_cli_args1(tmpdir): with ChangeCwd(tmpdir.strpath): cmdline_ref = ['boot', '--par-for-sub', '--pom', '--for_sub', '1234'] args = mkosi.parse_args(cmdline_ref) assert args['default'].verb == 'boot' assert args['default'].cmdline == cmdline_ref[1:]
def test_verb_summary_no_cli_args4(tmpdir: Path) -> None: with change_cwd(tmpdir): cmdline_ref = ["-pa-package", "-p", "another-package", "summary"] args = mkosi.parse_args(cmdline_ref) assert args["default"].verb == Verb.summary assert args["default"].packages == ["a-package", "another-package"]
def test_all_1(tested_config_all, tmpdir): """Generate the mkosi.default plus two config files plus short command line arguments""" with ChangeCwd(tmpdir.strpath): tested_config_all.prepare_mkosi_files(tmpdir.strpath) args = mkosi.parse_args(tested_config_all.cli_arguments) assert tested_config_all == args
def parse(argv: Optional[List[str]] = None) -> MkosiArgs: return mkosi.load_args(mkosi.parse_args(argv)["default"])
def test_verb_shell_cli_args7(tmpdir: Path) -> None: with change_cwd(tmpdir): cmdline_ref = ["-i", "summary"] args = mkosi.parse_args(cmdline_ref) assert args["default"].verb == Verb.summary assert args["default"].incremental == True
def test_verb_boot_no_cli_args1(tmpdir: Path) -> None: with change_cwd(tmpdir): cmdline_ref = ["boot", "--par-for-sub", "--pom", "--for_sub", "1234"] args = mkosi.parse_args(cmdline_ref) assert args["default"].verb == Verb.boot assert args["default"].cmdline == cmdline_ref[1:]
def test_verb_build(tmpdir: Path) -> None: with change_cwd(tmpdir): args = mkosi.parse_args(["build"]) assert args["default"].verb == Verb.build
def test_verb_boot_no_cli_args1(tmpdir): with ChangeCwd(tmpdir.strpath): cmdline_ref = ["boot", "--par-for-sub", "--pom", "--for_sub", "1234"] args = mkosi.parse_args(cmdline_ref) assert args["default"].verb == "boot" assert args["default"].cmdline == cmdline_ref[1:]
def test_verb_shell_cli_args7(tmpdir): with ChangeCwd(tmpdir.strpath): cmdline_ref = ["-i", "summary"] args = mkosi.parse_args(cmdline_ref) assert args["default"].verb == "summary" assert args["default"].incremental == True
def test_verb_summary_no_cli_args4(tmpdir): with ChangeCwd(tmpdir.strpath): cmdline_ref = ["-pa-package", "-p", "another-package", "summary"] args = mkosi.parse_args(cmdline_ref) assert args["default"].verb == "summary" assert args["default"].packages == ["a-package", "another-package"]
def test_all_1(tested_config_all: Any, tmpdir: Path) -> None: """Generate the mkosi.default plus two config files plus short command line arguments""" with change_cwd(tmpdir): tested_config_all.prepare_mkosi_files(tmpdir) args = mkosi.parse_args(tested_config_all.cli_arguments) assert tested_config_all == args
def test_verb_boot_no_cli_args3(tmpdir: Path) -> None: with change_cwd(tmpdir): cmdline_ref = ["-pa-package", "-p", "another-package", "build"] args = mkosi.parse_args(cmdline_ref) assert args["default"].verb == Verb.build assert args["default"].packages == ["a-package", "another-package"]