Skip to content

Commit

Permalink
Use _go_select instead of _libgcc_mutex in tests
Browse files Browse the repository at this point in the history
Remove dry-run and check result with umamba_list
  • Loading branch information
Hind-M committed Jun 12, 2024
1 parent 2773702 commit 9058ca3
Showing 1 changed file with 37 additions and 25 deletions.
62 changes: 37 additions & 25 deletions micromamba/tests/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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"]

Expand All @@ -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)
Expand All @@ -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"]

Expand All @@ -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)
Expand Down

0 comments on commit 9058ca3

Please sign in to comment.