mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Merge pull request #12217 from thejcannon/jcannon/issue12215
This commit is contained in:
commit
7c8425b8a0
1
news/12215.feature.rst
Normal file
1
news/12215.feature.rst
Normal file
|
@ -0,0 +1 @@
|
|||
Allow ``pip install --dry-run`` to use platform and ABI overriding options similar to ``--target``.
|
|
@ -92,10 +92,10 @@ def check_dist_restriction(options: Values, check_target: bool = False) -> None:
|
|||
)
|
||||
|
||||
if check_target:
|
||||
if dist_restriction_set and not options.target_dir:
|
||||
if not options.dry_run and dist_restriction_set and not options.target_dir:
|
||||
raise CommandError(
|
||||
"Can not use any platform or abi specific options unless "
|
||||
"installing via '--target'"
|
||||
"installing via '--target' or using '--dry-run'"
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -2541,6 +2541,40 @@ def test_install_pip_prints_req_chain_local(script: PipTestEnvironment) -> None:
|
|||
)
|
||||
|
||||
|
||||
def test_install_dist_restriction_without_target(script: PipTestEnvironment) -> None:
|
||||
result = script.pip(
|
||||
"install", "--python-version=3.1", "--only-binary=:all:", expect_error=True
|
||||
)
|
||||
assert (
|
||||
"Can not use any platform or abi specific options unless installing "
|
||||
"via '--target'" in result.stderr
|
||||
), str(result)
|
||||
|
||||
|
||||
def test_install_dist_restriction_dry_run_doesnt_require_target(
|
||||
script: PipTestEnvironment,
|
||||
) -> None:
|
||||
create_basic_wheel_for_package(
|
||||
script,
|
||||
"base",
|
||||
"0.1.0",
|
||||
)
|
||||
|
||||
result = script.pip(
|
||||
"install",
|
||||
"--python-version=3.1",
|
||||
"--only-binary=:all:",
|
||||
"--dry-run",
|
||||
"--no-cache-dir",
|
||||
"--no-index",
|
||||
"--find-links",
|
||||
script.scratch_path,
|
||||
"base",
|
||||
)
|
||||
|
||||
assert not result.stderr, str(result)
|
||||
|
||||
|
||||
@pytest.mark.network
|
||||
def test_install_pip_prints_req_chain_pypi(script: PipTestEnvironment) -> None:
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue