diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index 56efe2a5cfc..62e8ced46d9 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -10,6 +10,7 @@ from typing import Callable, Dict, Iterable, List, Optional, Tuple import pytest +from mypy_extensions import NamedArg from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.models.index import PyPI, TestPyPI @@ -2372,13 +2373,19 @@ def test_install_logs_pip_version_in_debug( assert_re_match(pattern, result.stdout) +_InstallFindLinks = Callable[ + [Iterable[str], NamedArg(bool, "dry_run"), NamedArg(Optional[Path], "target_dir")], + TestPipResult, +] + + @pytest.fixture def install_find_links( script: PipTestEnvironment, data: TestData, -) -> Callable[[Iterable[str], bool, Optional[Path]], TestPipResult]: +) -> _InstallFindLinks: def install( - args: Iterable[str], dry_run: bool, target_dir: Optional[Path] + args: Iterable[str], *, dry_run: bool, target_dir: Optional[Path] ) -> TestPipResult: return script.pip( "install", @@ -2407,7 +2414,7 @@ def install( def test_install_dry_run_nothing_installed( script: PipTestEnvironment, tmpdir: Path, - install_find_links: Callable[[Iterable[str], bool, Optional[Path]], TestPipResult], + install_find_links: _InstallFindLinks, with_target_dir: bool, ) -> None: """Test that pip install --dry-run logs what it would install, but doesn't actually @@ -2418,7 +2425,7 @@ def test_install_dry_run_nothing_installed( else: install_dir = None - result = install_find_links(["simple"], True, install_dir) + result = install_find_links(["simple"], dry_run=True, target_dir=install_dir) assert "Would install simple-3.0" in result.stdout assert "Successfully installed" not in result.stdout @@ -2428,7 +2435,7 @@ def test_install_dry_run_nothing_installed( # Ensure that the same install command would normally have worked if not for # --dry-run. - install_find_links(["simple"], False, install_dir) + install_find_links(["simple"], dry_run=False, target_dir=install_dir) if with_target_dir: assert os.listdir(install_dir) else: