mirror of https://github.com/mamba-org/mamba.git
Fix listing dependencies pulled with `pip` (#3963)
This commit is contained in:
parent
6e4be2889c
commit
835cbe8fcc
|
@ -303,9 +303,8 @@ namespace mamba
|
|||
{
|
||||
for (const auto& package : j["installed"])
|
||||
{
|
||||
// Get the package metadata, if requested and installed with `pip`
|
||||
if (package.contains("requested") && package.contains("installer")
|
||||
&& package["requested"] == true && package["installer"] == "pip")
|
||||
// Get the package metadata, if installed with `pip`
|
||||
if (package.contains("installer") && package["installer"] == "pip")
|
||||
{
|
||||
if (package.contains("metadata"))
|
||||
{
|
||||
|
|
|
@ -520,4 +520,8 @@ def test_env_export_with_pip(tmp_path, json_flag):
|
|||
pip_section = next(
|
||||
dep for dep in ret["dependencies"] if isinstance(dep, dict) and ["pip"] == [*dep]
|
||||
)
|
||||
assert pip_section["pip"] == ["requests==2.32.3"]
|
||||
pip_section_vals = pip_section["pip"]
|
||||
|
||||
# Check that `requests` and `urllib3` (pulled dependency) are exported
|
||||
assert "requests==2.32.3" in pip_section_vals
|
||||
assert any(pkg.startswith("urllib3==") for pkg in pip_section_vals)
|
||||
|
|
|
@ -160,7 +160,7 @@ channels:
|
|||
dependencies:
|
||||
- pip
|
||||
- pip:
|
||||
- numpy==1.26.4
|
||||
- pandas==2.2.3
|
||||
"""
|
||||
|
||||
|
||||
|
@ -178,9 +178,18 @@ def test_list_with_pip(tmp_home, tmp_root_prefix, tmp_path, no_pip_flag):
|
|||
|
||||
res = helpers.umamba_list("-n", env_name, "--json", no_pip_flag)
|
||||
if no_pip_flag == "":
|
||||
assert any(
|
||||
package["name"] == "pandas"
|
||||
and package["version"] == "2.2.3"
|
||||
and package["base_url"] == "https://pypi.org/"
|
||||
and package["build_string"] == "pypi_0"
|
||||
and package["channel"] == "pypi"
|
||||
and package["platform"] == sys.platform + "-" + platform.machine()
|
||||
for package in res
|
||||
)
|
||||
# Check that dependencies are listed
|
||||
assert any(
|
||||
package["name"] == "numpy"
|
||||
and package["version"] == "1.26.4"
|
||||
and package["base_url"] == "https://pypi.org/"
|
||||
and package["build_string"] == "pypi_0"
|
||||
and package["channel"] == "pypi"
|
||||
|
@ -188,7 +197,9 @@ def test_list_with_pip(tmp_home, tmp_root_prefix, tmp_path, no_pip_flag):
|
|||
for package in res
|
||||
)
|
||||
else: # --no-pip
|
||||
# Check that numpy installed with pip is not listed
|
||||
# Check that pandas installed with pip is not listed
|
||||
assert all(package["name"] != "pandas" for package in res)
|
||||
# Check that dependencies are not there either
|
||||
assert all(package["name"] != "numpy" for package in res)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue