Repository: kedro-org/kedro
File: features/steps/cli_steps.py (Python)

Code before:
    for path in ["README.md", "src", "pyproject.toml", "requirements.txt"]:
        assert is_created(path), f"{path} does not exist"

    tools_list = (
        tools.split(",") if tools != "all" else ["1", "2", "3", "4", "5", "6", "7"]
    )

    if "1" in tools_list:  # lint tool
        pass

    if "2" in tools_list:  # test tool
        assert is_created("tests"), "tests directory does not exist"

    if "3" in tools_list:  # log tool
        assert is_created("conf/logging.yml"), "logging configuration does not exist"

    if "4" in tools_list:  # docs tool
        assert is_created("docs"), "docs directory does not exist"

    if "5" in tools_list:  # data tool
        assert is_created("data"), "data directory does not exist"

    if "6" in tools_list:  # PySpark tool
        assert is_created("conf/base/spark.yml"), "spark.yml does not exist"

    if "7" in tools_list:  # 'viz' tool
        expected_reporting_path = Path(
            f"src/{context.package_name}/pipelines/reporting"
        )
        assert is_created(
            expected_reporting_path
        ), "reporting pipeline directory does not exist"


@then("the logs should show that {number} nodes were run")
def check_one_node_run(context, number):
    expected_log_line = f"Completed {number} out of {number} tasks"
    assert expected_log_line in context.result.stdout


@then('the logs should show that "{node}" was run')
def check_correct_nodes_run(context, node):
    expected_log_line = f"Running node: {node}"
    stdout = context.result.stdout
    assert expected_log_line in stdout, (
        "Expected the following message segment to be printed on stdout: "
        f"{expected_log_line},\nbut got {stdout}"
    )


@then("I should get a successful exit code")

Review comment (suggestion):
```suggestion
    if "7" in tools_list:  # viz tool
```
Nit: For consistency :)

Code after:
    for path in ["README.md", "src", "pyproject.toml", "requirements.txt"]:
        assert is_created(path), f"{path} does not exist"

    tools_list = (
        tools.split(",") if tools != "all" else ["1", "2", "3", "4", "5", "6", "7"]
    )

    if "1" in tools_list:  # lint tool
        pass  # No files are added

    if "2" in tools_list:  # test tool
        assert is_created("tests"), "tests directory does not exist"

    if "3" in tools_list:  # log tool
        assert is_created("conf/logging.yml"), "logging configuration does not exist"

    if "4" in tools_list:  # docs tool
        assert is_created("docs"), "docs directory does not exist"

    if "5" in tools_list:  # data tool
        assert is_created("data"), "data directory does not exist"

    if "6" in tools_list:  # PySpark tool
        assert is_created("conf/base/spark.yml"), "spark.yml does not exist"

    if "7" in tools_list:  # viz tool
        expected_reporting_path = Path(
            f"src/{context.package_name}/pipelines/reporting"
        )
        assert is_created(
            expected_reporting_path
        ), "reporting pipeline directory does not exist"


@then("the logs should show that {number} nodes were run")
def check_one_node_run(context, number):
    expected_log_line = f"Completed {number} out of {number} tasks"
    assert expected_log_line in context.result.stdout


@then('the logs should show that "{node}" was run')
def check_correct_nodes_run(context, node):
    expected_log_line = f"Running node: {node}"
    stdout = context.result.stdout
    assert expected_log_line in stdout, (
        "Expected the following message segment to be printed on stdout: "
        f"{expected_log_line},\nbut got {stdout}"
    )


@then("I should get a successful exit code")