示例#1
0
def test_nervosum_parser_input_build_config() -> None:
    expected = argparse.Namespace(cmd="build",
                                  c="a_file",
                                  dir=".",
                                  nervosum_module="nervosum.core.build")

    assert expected == parse_args(["build", ".", "-c", "a_file"])
示例#2
0
def test_nervosum_parser_input_build_dir() -> None:
    expected = argparse.Namespace(
        cmd="build",
        c="nervosum.yaml",
        dir=".",
        nervosum_module="nervosum.core.build",
    )

    assert expected == parse_args(["build", "."])
示例#3
0
def test_nervosum_parser_input_ls_filter() -> None:
    expected = argparse.Namespace(
        cmd="ls",
        filter=["key==value", "key2==value2"],
        nervosum_module="nervosum.core.list",
    )

    assert expected == parse_args(
        ["ls", "-f", "key==value", "--filter", "key2==value2"])
示例#4
0
def test_nervosum_parser_input_run(
    tag: str,
    tag_value: str,
    name: str,
    name_value: str,
    run: Callable,
):
    expected = run(name=name_value, tag=tag_value)
    args = ["run"]
    if tag and tag_value:
        args += [tag, tag_value]
    if name and name_value:
        args += [name, name_value]
    assert expected == parse_args(args)
示例#5
0
文件: main.py 项目: nervosum/nervosum
def main() -> None:
    args = nervosum_parser.parse_args()
    module = importlib.import_module(args.nervosum_module)
    module.execute(args)  # type: ignore
示例#6
0
def test_nervosum_parser_invalid_command() -> None:
    with pytest.raises(SystemExit):
        parse_args(["invalid"])
示例#7
0
def test_nervosum_parser_input_build_no_input() -> None:
    with pytest.raises(SystemExit):
        parse_args(["build"])
示例#8
0
def test_nervosum_parser_input_ls_no_inputs() -> None:
    expected = argparse.Namespace(cmd="ls",
                                  filter=None,
                                  nervosum_module="nervosum.core.list")

    assert expected == parse_args(["ls"])