diff --git a/micromamba/tests/test_env.py b/micromamba/tests/test_env.py index db443a44b0..c90f7d6d83 100644 --- a/micromamba/tests/test_env.py +++ b/micromamba/tests/test_env.py @@ -484,3 +484,36 @@ def test_env_update_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_yaml_content_to_install_numpy_with_pip = """ +channels: +- conda-forge +dependencies: +- pip +- pip: + - numpy==1.26.4 +""" + + +@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) +def test_env_export_with_pip(tmp_home, tmp_root_prefix, tmp_path): + env_name = "env-list_with_pip" + tmp_root_prefix / "envs" / env_name + + env_file_yml = tmp_path / "test_env_yaml_content_to_install_numpy_with_pip.yaml" + env_file_yml.write_text(env_yaml_content_to_install_numpy_with_pip) + + helpers.create("-n", env_name, "test_env_export_with_pip", "--json", no_dry_run=True) + helpers.install("-n", env_name, "-f", env_file_yml, "--json", no_dry_run=True) + + output = helpers.run_env("export", "-n", env_name, "--json") + ret = yaml.safe_load(output) + + assert ret["name"] == env_name + assert env_name in ret["prefix"] + assert set(ret["channels"]) == {"conda-forge"} + assert any("pip" in dep for dep in ret["dependencies"]) + + # Check that numpy is exported under the pip subsection of the dependencies + assert any("numpy" in dep for dep in ret["dependencies"]["pip"])