Skip to content

Commit

Permalink
pipx --preinstall ignores dependency version specifier pypa#1377
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpeckham committed Apr 26, 2024
1 parent c44d210 commit 9a7b28a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/1377.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Install specified version of `--preinstall` dependency instead of latest version
3 changes: 1 addition & 2 deletions src/pipx/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ def install(
override_shared = package_name == "pip"
venv.create_venv(venv_args, pip_args, override_shared)
for dep in preinstall_packages or []:
dep_name = package_name_from_spec(dep, python, pip_args=pip_args, verbose=verbose)
venv.upgrade_package_no_metadata(dep_name, [])
venv.upgrade_package_no_metadata(dep, [])
venv.install_package(
package_name=package_name,
package_or_url=package_spec,
Expand Down
5 changes: 5 additions & 0 deletions tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@ def test_preinstall_multiple(pipx_temp_env, caplog):
assert "colorama" in caplog.text


def test_preinstall_specific_version(pipx_temp_env, caplog):
assert not run_pipx_cli(["install", "--preinstall", "black==22.8.0", "nox"])
assert "black==22.8.0" in caplog.text


@pytest.mark.xfail
def test_do_not_wait_for_input(pipx_temp_env, pipx_session_shared_dir, monkeypatch):
monkeypatch.setenv("PIP_INDEX_URL", "http://127.0.0.1:8080/simple")
Expand Down

0 comments on commit 9a7b28a

Please sign in to comment.