mirror of https://github.com/mamba-org/mamba.git
fix: Effectively apply dry-run on installation from PyPI (#3644)
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
This commit is contained in:
parent
e67178ce8a
commit
8ea3103d3c
|
@ -537,10 +537,13 @@ namespace mamba
|
|||
|
||||
trans.execute(ctx, channel_context, prefix_data);
|
||||
|
||||
for (auto other_spec : config.at("others_pkg_mgrs_specs")
|
||||
.value<std::vector<detail::other_pkg_mgr_spec>>())
|
||||
if (!ctx.dry_run)
|
||||
{
|
||||
install_for_other_pkgmgr(ctx, other_spec, pip::Update::No);
|
||||
for (auto other_spec : config.at("others_pkg_mgrs_specs")
|
||||
.value<std::vector<detail::other_pkg_mgr_spec>>())
|
||||
{
|
||||
install_for_other_pkgmgr(ctx, other_spec, pip::Update::No);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -796,3 +796,37 @@ def test_install_empty_base(tmp_home, tmp_root_prefix, tmp_path):
|
|||
packages = helpers.umamba_list("-p", env_prefix, "--json")
|
||||
assert any(package["name"] == "xtensor" for package in packages)
|
||||
assert any(package["name"] == "python" for package in packages)
|
||||
|
||||
|
||||
env_specific_pip = """
|
||||
channels:
|
||||
- conda-forge
|
||||
dependencies:
|
||||
- python
|
||||
- pip:
|
||||
- numpy
|
||||
"""
|
||||
|
||||
|
||||
# Test that dry runs works if package are specified for the `pip:` section
|
||||
def test_dry_run_pip_section(tmp_home, tmp_root_prefix, tmp_path):
|
||||
env_prefix = tmp_path / "env-specific-pip"
|
||||
|
||||
env_file_yml = tmp_path / "test_install_env_specific_pip.yaml"
|
||||
env_file_yml.write_text(env_specific_pip)
|
||||
|
||||
res = helpers.create("-p", env_prefix, "--json", "pip")
|
||||
assert res["success"]
|
||||
packages_at_creation = helpers.umamba_list("-p", env_prefix, "--json")
|
||||
|
||||
# Install from the environment file
|
||||
res = helpers.install("-p", env_prefix, "-f", env_file_yml, "--json", "--dry-run")
|
||||
assert res["success"]
|
||||
assert res["dry_run"]
|
||||
|
||||
packages = helpers.umamba_list("-p", env_prefix, "--json")
|
||||
assert packages == packages_at_creation
|
||||
|
||||
# Check that the packages are not installed using `pip`
|
||||
res = helpers.umamba_run("-p", env_prefix, "pip", "list")
|
||||
assert "numpy" not in res
|
||||
|
|
Loading…
Reference in New Issue