Skip to content

Commit 00f425a

Browse files
committed
add test for explicit subcommand
1 parent e04b6ab commit 00f425a

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

micromamba/tests/test_list.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ def test_list(
2727
assert "xtensor" in names
2828
assert "xtl" in names
2929
assert all(
30-
i["channel"] == "conda-forge" and i["base_url"] == "https://conda.anaconda.org/conda-forge"
30+
i["channel"] == "conda-forge"
31+
and i["base_url"] == "https://conda.anaconda.org/conda-forge"
32+
and i["name"] in i["url"]
33+
and "conda-forge" in i["url"]
3134
for i in res
3235
)
3336

@@ -56,7 +59,7 @@ def test_list_no_json(
5659
assert "xtensor" in res
5760
assert "xtl" in res
5861

59-
# This is what res looks like in this case (with or without a header delimiter):
62+
# This is what res looks like in this case:
6063
# List of packages in environment: "xxx"
6164

6265
# Name Version Build Channel
@@ -76,6 +79,25 @@ def test_list_no_json(
7679
assert res.find("xtensor") < res.find("xtl")
7780

7881

82+
@pytest.mark.parametrize("explicit_flag", ["", "--explicit"])
83+
@pytest.mark.parametrize("env_selector", ["", "name", "prefix"])
84+
@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True)
85+
def test_list_explicit_no_json(
86+
tmp_home, tmp_root_prefix, tmp_env_name, tmp_xtensor_env, env_selector, explicit_flag
87+
):
88+
if env_selector == "prefix":
89+
res = helpers.umamba_list("-p", tmp_xtensor_env, explicit_flag)
90+
elif env_selector == "name":
91+
res = helpers.umamba_list("-n", tmp_env_name, explicit_flag)
92+
else:
93+
res = helpers.umamba_list(explicit_flag)
94+
95+
packages_url_list = res.strip().split("\n")[2:]
96+
if explicit_flag == "--explicit":
97+
for url in packages_url_list:
98+
assert "conda-forge" in url
99+
100+
79101
@pytest.mark.parametrize("quiet_flag", ["", "-q", "--quiet"])
80102
@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True)
81103
def test_list_name(tmp_home, tmp_root_prefix, tmp_xtensor_env, quiet_flag):

0 commit comments

Comments
 (0)