Skip to content

Commit 9c52698

Browse files
use kw-only args for install_find_links() fixture
1 parent 700af48 commit 9c52698

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

tests/functional/test_install.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from typing import Callable, Dict, Iterable, List, Optional, Tuple
1111

1212
import pytest
13+
from mypy_extensions import NamedArg
1314

1415
from pip._internal.cli.status_codes import ERROR, SUCCESS
1516
from pip._internal.models.index import PyPI, TestPyPI
@@ -2372,13 +2373,19 @@ def test_install_logs_pip_version_in_debug(
23722373
assert_re_match(pattern, result.stdout)
23732374

23742375

2376+
_InstallFindLinks = Callable[
2377+
[Iterable[str], NamedArg(bool, "dry_run"), NamedArg(Optional[Path], "target_dir")],
2378+
TestPipResult,
2379+
]
2380+
2381+
23752382
@pytest.fixture
23762383
def install_find_links(
23772384
script: PipTestEnvironment,
23782385
data: TestData,
2379-
) -> Callable[[Iterable[str], bool, Optional[Path]], TestPipResult]:
2386+
) -> _InstallFindLinks:
23802387
def install(
2381-
args: Iterable[str], dry_run: bool, target_dir: Optional[Path]
2388+
args: Iterable[str], *, dry_run: bool, target_dir: Optional[Path]
23822389
) -> TestPipResult:
23832390
return script.pip(
23842391
"install",
@@ -2407,7 +2414,7 @@ def install(
24072414
def test_install_dry_run_nothing_installed(
24082415
script: PipTestEnvironment,
24092416
tmpdir: Path,
2410-
install_find_links: Callable[[Iterable[str], bool, Optional[Path]], TestPipResult],
2417+
install_find_links: _InstallFindLinks,
24112418
with_target_dir: bool,
24122419
) -> None:
24132420
"""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(
24182425
else:
24192426
install_dir = None
24202427

2421-
result = install_find_links(["simple"], True, install_dir)
2428+
result = install_find_links(["simple"], dry_run=True, target_dir=install_dir)
24222429
assert "Would install simple-3.0" in result.stdout
24232430
assert "Successfully installed" not in result.stdout
24242431

@@ -2428,7 +2435,7 @@ def test_install_dry_run_nothing_installed(
24282435

24292436
# Ensure that the same install command would normally have worked if not for
24302437
# --dry-run.
2431-
install_find_links(["simple"], False, install_dir)
2438+
install_find_links(["simple"], dry_run=False, target_dir=install_dir)
24322439
if with_target_dir:
24332440
assert os.listdir(install_dir)
24342441
else:

0 commit comments

Comments
 (0)