diff --git a/micromamba/tests/test_create.py b/micromamba/tests/test_create.py index e34b827324..7771198bd5 100644 --- a/micromamba/tests/test_create.py +++ b/micromamba/tests/test_create.py @@ -1203,15 +1203,17 @@ def test_create_from_oci_mirrored_channels(tmp_home, tmp_root_prefix, tmp_path, default_channel=False, no_rc=False, ) + assert res["success"] - assert res["actions"]["PREFIX"] == str(env_prefix) - for pkg in res["actions"]["LINK"]: - assert pkg["url"].startswith( - "https://pkg-containers.githubusercontent.com/ghcr1/blobs/pandoc" - ) - assert pkg["name"] == "pandoc" - if spec == "pandoc=3.1.13": - assert pkg["version"] == "3.1.13" + packages = helpers.umamba_list("-p", env_prefix, "--json") + assert len(packages) == 1 + pkg = packages[0] + assert pkg["name"] == "pandoc" + if spec == "pandoc=3.1.13": + assert pkg["version"] == "3.1.13" + assert pkg["base_url"].startswith( + "https://pkg-containers.githubusercontent.com/ghcr1/blobs/pandoc" + ) @pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) @@ -1223,7 +1225,7 @@ def test_create_from_oci_mirrored_channels_with_deps(tmp_home, tmp_root_prefix, rc_file = tmp_path / "config.yaml" rc_file.write_text(yaml.dump(oci_registry_config)) - cmd = ["-n", env_name, "xtensor", "--dry-run", "--json", "-c", "oci_channel"] + cmd = ["-n", env_name, "xtensor", "--json", "-c", "oci_channel"] if parser == "libsolv": cmd += ["--no-exp-repodata-parsing"] @@ -1233,12 +1235,24 @@ def test_create_from_oci_mirrored_channels_with_deps(tmp_home, tmp_root_prefix, default_channel=False, no_rc=False, ) + assert res["success"] - assert res["actions"]["PREFIX"] == str(env_prefix) - for pkg in res["actions"]["LINK"]: - assert pkg["url"].startswith("https://pkg-containers.githubusercontent.com/ghcr1/blobs/") - assert any(pkg["name"] == "xtensor" for pkg in res["actions"]["LINK"]) - assert any(pkg["name"] == "xtl" for pkg in res["actions"]["LINK"]) + packages = helpers.umamba_list("-p", env_prefix, "--json") + assert len(packages) > 2 + assert any( + package["name"] == "xtensor" + and package["base_url"].startswith( + "https://pkg-containers.githubusercontent.com/ghcr1/blobs/xtensor" + ) + for package in packages + ) + assert any( + package["name"] == "xtl" + and package["base_url"].startswith( + "https://pkg-containers.githubusercontent.com/ghcr1/blobs/xtl" + ) + for package in packages + ) @pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) @@ -1248,17 +1262,13 @@ def test_create_from_oci_mirrored_channels_pkg_name_mapping( ): # This is to test Conda/OCI package name mapping # Test fetching package from OCI registry with name starting with '_' - # Packages with such names are not common to all platforms - # So this test is only run on Linux - if platform.system() != "Linux": - return env_name = "myenv" env_prefix = tmp_root_prefix / "envs" / env_name rc_file = tmp_path / "config.yaml" rc_file.write_text(yaml.dump(oci_registry_config)) - cmd = ["-n", env_name, "_libgcc_mutex", "--dry-run", "--json", "-c", "oci_channel"] + cmd = ["-n", env_name, "_go_select", "--json", "-c", "oci_channel"] if parser == "libsolv": cmd += ["--no-exp-repodata-parsing"] @@ -1268,13 +1278,15 @@ def test_create_from_oci_mirrored_channels_pkg_name_mapping( default_channel=False, no_rc=False, ) + assert res["success"] - assert res["actions"]["PREFIX"] == str(env_prefix) - for pkg in res["actions"]["LINK"]: - assert pkg["url"].startswith( - "https://pkg-containers.githubusercontent.com/ghcr1/blobs/_libgcc_mutex" - ) - assert pkg["name"] == "_libgcc_mutex" + packages = helpers.umamba_list("-p", env_prefix, "--json") + assert len(packages) == 1 + pkg = packages[0] + assert pkg["name"] == "_go_select" + assert pkg["base_url"].startswith( + "https://pkg-containers.githubusercontent.com/ghcr1/blobs/_go_select" + ) @pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True)