Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test_env_update_pypi_with_conda_forge #3459

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions micromamba/tests/test_env.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import re
import shutil

from packaging.version import Version
from pathlib import Path

import pytest
Expand Down Expand Up @@ -152,8 +154,6 @@ def test_env_update(tmp_home, tmp_root_prefix, tmp_path, prune):
assert not any(package["name"] == "ipython" for package in packages)

# Update python
from packaging.version import Version

env_file_yml = tmp_path / "test_env.yaml"
env_file_yml.write_text(env_yaml_content_with_version_and_new_pkg)

Expand Down Expand Up @@ -361,5 +361,12 @@ def test_env_update_pypi_with_conda_forge(tmp_home, tmp_root_prefix, tmp_path):
## See: https://github.com/mamba-org/mamba/issues/2059
pip_list_output = helpers.umamba_run("-p", env_prefix, "pip", "list", "--format=json")
pip_packages_list = yaml.safe_load(pip_list_output)

assert any(pkg["name"] == "numpy" and pkg["version"] == "1.26.4" for pkg in pip_packages_list)
# When numpy 2.0.0 is installed using mamba,
# `numpy-2.0.0.dist-info/` is still created in `env_prefix/lib/pythonx.x/site-packages/` alongside `numpy-1.26.4.dist-info`
# therefore causing an unexpected result when listing the version.
# In an ideal world, multiple package managers shouldn't be mixed but since this is supported, tests are here
# (note that a warning is printed to the user in that case)
assert any(
pkg["name"] == "numpy" and Version(pkg["version"]) >= Version("1.26.4")
for pkg in pip_packages_list
)
Loading