10
10
from typing import Callable , Dict , Iterable , List , Optional , Tuple
11
11
12
12
import pytest
13
+ from mypy_extensions import NamedArg
13
14
14
15
from pip ._internal .cli .status_codes import ERROR , SUCCESS
15
16
from pip ._internal .models .index import PyPI , TestPyPI
@@ -2372,13 +2373,19 @@ def test_install_logs_pip_version_in_debug(
2372
2373
assert_re_match (pattern , result .stdout )
2373
2374
2374
2375
2376
+ _InstallFindLinks = Callable [
2377
+ [Iterable [str ], NamedArg (bool , "dry_run" ), NamedArg (Optional [Path ], "target_dir" )],
2378
+ TestPipResult ,
2379
+ ]
2380
+
2381
+
2375
2382
@pytest .fixture
2376
2383
def install_find_links (
2377
2384
script : PipTestEnvironment ,
2378
2385
data : TestData ,
2379
- ) -> Callable [[ Iterable [ str ], bool , Optional [ Path ]], TestPipResult ] :
2386
+ ) -> _InstallFindLinks :
2380
2387
def install (
2381
- args : Iterable [str ], dry_run : bool , target_dir : Optional [Path ]
2388
+ args : Iterable [str ], * , dry_run : bool , target_dir : Optional [Path ]
2382
2389
) -> TestPipResult :
2383
2390
return script .pip (
2384
2391
"install" ,
@@ -2407,7 +2414,7 @@ def install(
2407
2414
def test_install_dry_run_nothing_installed (
2408
2415
script : PipTestEnvironment ,
2409
2416
tmpdir : Path ,
2410
- install_find_links : Callable [[ Iterable [ str ], bool , Optional [ Path ]], TestPipResult ] ,
2417
+ install_find_links : _InstallFindLinks ,
2411
2418
with_target_dir : bool ,
2412
2419
) -> None :
2413
2420
"""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(
2418
2425
else :
2419
2426
install_dir = None
2420
2427
2421
- result = install_find_links (["simple" ], True , install_dir )
2428
+ result = install_find_links (["simple" ], dry_run = True , target_dir = install_dir )
2422
2429
assert "Would install simple-3.0" in result .stdout
2423
2430
assert "Successfully installed" not in result .stdout
2424
2431
@@ -2428,7 +2435,7 @@ def test_install_dry_run_nothing_installed(
2428
2435
2429
2436
# Ensure that the same install command would normally have worked if not for
2430
2437
# --dry-run.
2431
- install_find_links (["simple" ], False , install_dir )
2438
+ install_find_links (["simple" ], dry_run = False , target_dir = install_dir )
2432
2439
if with_target_dir :
2433
2440
assert os .listdir (install_dir )
2434
2441
else :
0 commit comments