Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Hind-M committed Dec 26, 2024
1 parent ae3fc2d commit 209ef04
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions micromamba/tests/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,46 @@ def test_create_with_non_existing_subdir(tmp_home, tmp_root_prefix, tmp_path):
helpers.create("-p", env_prefix, "--dry-run", "--json", "conda-forge/noarch::xtensor")


@pytest.mark.parametrize(
"spec",
[
"https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-main.tar.bz2",
"https://conda.anaconda.org/conda-forge/linux-64/abacus-3.2.4-hb6c440e_0.conda",
],
)
def test_create_with_explicit_url(tmp_home, tmp_root_prefix, tmp_path, spec):
"""Attempts to install a package using an explicit url."""
empty_root_prefix = tmp_path / "empty-root-create-from-explicit-url"
env_name = "env-create-from-explicit-url"

os.environ["MAMBA_ROOT_PREFIX"] = str(empty_root_prefix)

res = helpers.create(
spec, "--no-env", "-n", env_name, "--override-channels", "--json", default_channel=False
)
assert res["success"]

pkgs = res["actions"]["LINK"]
if spec.endswith(".tar.bz2"):
assert len(pkgs) == 1
assert pkgs[0]["name"] == "_libgcc_mutex"
assert pkgs[0]["version"] == "0.1"
assert (
pkgs[0]["url"]
== "https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-main.tar.bz2"
)
assert pkgs[0]["channel"] == "https://conda.anaconda.org/conda-forge"
else:
assert len(pkgs) == 1
assert pkgs[0]["name"] == "abacus"
assert pkgs[0]["version"] == "3.2.4"
assert (
pkgs[0]["url"]
== "https://conda.anaconda.org/conda-forge/linux-64/abacus-3.2.4-hb6c440e_0.conda"
)
assert pkgs[0]["channel"] == "https://conda.anaconda.org/conda-forge"


@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True)
def test_create_with_multiple_files(tmp_home, tmp_root_prefix, tmpdir):
env_name = "myenv"
Expand Down

0 comments on commit 209ef04

Please sign in to comment.