Repository: pypa/pip
File: tests/functional/test_pep660.py (Python)

Code before:
    _assert_hook_called(project_dir, "build_wheel")


def test_install_pep660_basic(tmpdir: Path, script: PipTestEnvironment) -> None:
    """
    Test with backend that supports build_editable.
    """
    project_dir = _make_project(tmpdir, BACKEND_WITH_PEP660, with_setup_py=False)
    result = script.pip(
        "install",
        "--no-index",
        "--no-build-isolation",
        "--editable",
        project_dir,
        "--config-settings",
        "x=y",
    )
    _assert_hook_called(project_dir, "prepare_metadata_for_build_editable")
    _assert_hook_called_with_config_settings(project_dir, "build_editable", {"x": "y"})
    assert (
        result.test_env.site_packages.joinpath("project.egg-link")
        not in result.files_created
    ), "a .egg-link file should not have been created"


def test_install_pep660_from_req_file(tmpdir: Path, script: PipTestEnvironment) -> None:
    """
    Test with backend that supports build_editable.
    """
    project_dir = _make_project(tmpdir, BACKEND_WITH_PEP660, with_setup_py=False)
    reqs_file = tmpdir / "requirements.txt"
    reqs_file.write_text(f"-e {project_dir.as_uri()} --config-setting x=y\n")
    result = script.pip(
        "install",
        "--no-index",
        "--no-build-isolation",
        "-r",
        reqs_file,
    )
    _assert_hook_called(project_dir, "prepare_metadata_for_build_editable")
    _assert_hook_called_with_config_settings(project_dir, "build_editable", {"x": "y"})
    assert (
        result.test_env.site_packages.joinpath("project.egg-link")
        not in result.files_created
    ), "a .egg-link file should not have been created"


def test_install_no_pep660_setup_py_fallback(
    tmpdir: Path, script: PipTestEnvironment
) -> None:
    """

Review comment (suggestion):
```suggestion
def test_install_pep660_from_reqs_file(tmpdir: Path, script: PipTestEnvironment) -> None:
```

Code after:
    _assert_hook_called(project_dir, "build_wheel")


def test_install_pep660_basic(tmpdir: Path, script: PipTestEnvironment) -> None:
    """
    Test with backend that supports build_editable.
    """
    project_dir = _make_project(tmpdir, BACKEND_WITH_PEP660, with_setup_py=False)
    result = script.pip(
        "install",
        "--no-index",
        "--no-build-isolation",
        "--editable",
        project_dir,
        "--config-setting",
        "x=y",
    )
    _assert_hook_called(project_dir, "prepare_metadata_for_build_editable")
    _assert_hook_called_with_config_settings(project_dir, "build_editable", {"x": "y"})
    assert (
        result.test_env.site_packages.joinpath("project.egg-link")
        not in result.files_created
    ), "a .egg-link file should not have been created"


def test_install_pep660_from_reqs_file(
    tmpdir: Path, script: PipTestEnvironment
) -> None:
    """
    Test with backend that supports build_editable.
    """
    project_dir = _make_project(tmpdir, BACKEND_WITH_PEP660, with_setup_py=False)
    reqs_file = tmpdir / "requirements.txt"
    reqs_file.write_text(f"-e {project_dir.as_uri()} --config-setting x=y\n")
    result = script.pip(
        "install",
        "--no-index",
        "--no-build-isolation",
        "-r",
        reqs_file,
    )
    _assert_hook_called(project_dir, "prepare_metadata_for_build_editable")
    _assert_hook_called_with_config_settings(project_dir, "build_editable", {"x": "y"})
    assert (
        result.test_env.site_packages.joinpath("project.egg-link")
        not in result.files_created
    ), "a .egg-link file should not have been created"


def test_install_no_pep660_setup_py_fallback(
    tmpdir: Path, script: PipTestEnvironment