Skip to content

Commit 1b9a534

Browse files
committed
update test
1 parent ad265d0 commit 1b9a534

File tree

2 files changed

+20
-27
lines changed

2 files changed

+20
-27
lines changed

libmamba/src/api/list.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ namespace mamba
218218
{
219219
if (options.canonical)
220220
{
221-
std::cout << "Warning: Option --canonical ignored because of --explicit \n"
222-
<< std::endl;
221+
LOG_WARNING << "Warning: Option --canonical ignored because of --explicit"
222+
<< std::endl;
223223
}
224224
for (auto p : packages)
225225
{

micromamba/tests/test_list.py

+18-25
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,25 @@ def test_list_no_json(
8181

8282
@pytest.mark.parametrize("explicit_flag", ["", "--explicit"])
8383
@pytest.mark.parametrize("md5_flag", ["", "--md5"])
84+
@pytest.mark.parametrize("canonical_flag", ["", "-c", "--canonical"])
8485
@pytest.mark.parametrize("env_selector", ["", "name", "prefix"])
8586
@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True)
86-
def test_list_explicit(
87-
tmp_home, tmp_root_prefix, tmp_env_name, tmp_xtensor_env, env_selector, explicit_flag, md5_flag
87+
def test_list_subcommands(
88+
tmp_home,
89+
tmp_root_prefix,
90+
tmp_env_name,
91+
tmp_xtensor_env,
92+
env_selector,
93+
explicit_flag,
94+
md5_flag,
95+
canonical_flag,
8896
):
8997
if env_selector == "prefix":
90-
res = helpers.umamba_list("-p", tmp_xtensor_env, explicit_flag, md5_flag)
98+
res = helpers.umamba_list("-p", tmp_xtensor_env, explicit_flag, md5_flag, canonical_flag)
9199
elif env_selector == "name":
92-
res = helpers.umamba_list("-n", tmp_env_name, explicit_flag, md5_flag)
100+
res = helpers.umamba_list("-n", tmp_env_name, explicit_flag, md5_flag, canonical_flag)
93101
else:
94-
res = helpers.umamba_list(explicit_flag, md5_flag)
102+
res = helpers.umamba_list(explicit_flag, md5_flag, canonical_flag)
95103

96104
outputs_list = res.strip().split("\n")[2:]
97105
if explicit_flag == "--explicit":
@@ -101,27 +109,12 @@ def test_list_explicit(
101109
assert "#" in output
102110
else:
103111
assert "#" not in output
104-
105-
106-
@pytest.mark.parametrize("canonical_flag", ["", "--canonical"])
107-
@pytest.mark.parametrize("env_selector", ["", "name", "prefix"])
108-
@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True)
109-
def test_list_canonical(
110-
tmp_home, tmp_root_prefix, tmp_env_name, tmp_xtensor_env, env_selector, canonical_flag
111-
):
112-
if env_selector == "prefix":
113-
res = helpers.umamba_list("-p", tmp_xtensor_env, canonical_flag)
114-
elif env_selector == "name":
115-
res = helpers.umamba_list("-n", tmp_env_name, canonical_flag)
116112
else:
117-
res = helpers.umamba_list(canonical_flag)
118-
119-
outputs_list = res.strip().split("\n")[2:]
120-
if canonical_flag == "--canonical":
121-
items = ["conda-forge/", "::"]
122-
for output in outputs_list:
123-
assert all(i in output for i in items)
124-
assert " " not in output
113+
if canonical_flag == "--canonical":
114+
items = ["conda-forge/", "::"]
115+
for output in outputs_list:
116+
assert all(i in output for i in items)
117+
assert " " not in output
125118

126119

127120
@pytest.mark.parametrize("quiet_flag", ["", "-q", "--quiet"])

0 commit comments

Comments
 (0)