Repository: kedro-org/kedro
File: tests/framework/cli/test_starters.py (Python)

Code before:
    result,
    tools="none",
    repo_name="new-kedro-project",
    output_dir=".",
):
    assert result.exit_code == 0, result.output

    root_path = (Path(output_dir) / repo_name).resolve()

    assert "Congratulations!" in result.output
    assert f"has been created in the directory \n{root_path}" in result.output

    requirements_file_path = root_path / "requirements.txt"
    pyproject_file_path = root_path / "pyproject.toml"

    tools_list = _parse_tools_input(tools)

    if "1" in tools_list:
        with open(requirements_file_path) as requirements_file:
            requirements = requirements_file.read()

        assert "ruff" in requirements

        print(pyproject_file_path.read_text())
        pyproject_config = toml.load(pyproject_file_path)
        print(pyproject_config)
        expected = {
            "tool": {
                "ruff": {
                    "line-length": 88,
                    "show-fixes": True,
                    "select": ["F", "W", "E", "I", "UP", "PL", "T201"],
                    "ignore": ["E501"],
                    "format": {"docstring-code-format": True},
                }
            }
        }
        assert expected["tool"]["ruff"] == pyproject_config["tool"]["ruff"]

    if "2" in tools_list:
        with open(requirements_file_path) as requirements_file:
            requirements = requirements_file.read()

        assert "pytest-cov~=3.0" in requirements
        assert "pytest-mock>=1.7.1, <2.0" in requirements
        assert "pytest~=7.2" in requirements

        pyproject_config = toml.load(pyproject_file_path)
        expected = {
            "pytest": {
                "ini_options": {

Review comment (bug):
I'm guessing these `print` statements are left overs from debugging?

Code after:
        expected_files += (
            4 if "7" in tools_list else 0
        )  # add 3 .py and 1 parameters files in reporting for Viz
        expected_files += (
            1 if "2" in tools_list else 0
        )  # add 1 test file if tests is chosen in tools

    return expected_files


def _assert_requirements_ok(
    result,
    tools="none",
    repo_name="new-kedro-project",
    output_dir=".",
):
    assert result.exit_code == 0, result.output

    root_path = (Path(output_dir) / repo_name).resolve()

    assert "Congratulations!" in result.output
    assert f"has been created in the directory \n{root_path}" in result.output

    requirements_file_path = root_path / "requirements.txt"
    pyproject_file_path = root_path / "pyproject.toml"

    tools_list = _parse_tools_input(tools)

    if "1" in tools_list:
        with open(requirements_file_path) as requirements_file:
            requirements = requirements_file.read()

        assert "ruff" in requirements

        pyproject_config = toml.load(pyproject_file_path)
        expected = {
            "tool": {
                "ruff": {
                    "line-length": 88,
                    "show-fixes": True,
                    "select": ["F", "W", "E", "I", "UP", "PL", "T201"],
                    "ignore": ["E501"],
                    "format": {"docstring-code-format": True},
                }
            }
        }
        assert expected["tool"]["ruff"] == pyproject_config["tool"]["ruff"]

    if "2" in tools_list:
        with open(requirements_file_path) as requirements_file:
            requirements = requirements_file.read()