-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add canonical flag to list command #3777
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,17 +81,25 @@ def test_list_no_json( | |
|
||
@pytest.mark.parametrize("explicit_flag", ["", "--explicit"]) | ||
@pytest.mark.parametrize("md5_flag", ["", "--md5"]) | ||
@pytest.mark.parametrize("canonical_flag", ["", "-c", "--canonical"]) | ||
@pytest.mark.parametrize("env_selector", ["", "name", "prefix"]) | ||
@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) | ||
def test_list_explicit( | ||
tmp_home, tmp_root_prefix, tmp_env_name, tmp_xtensor_env, env_selector, explicit_flag, md5_flag | ||
def test_list_subcommands( | ||
tmp_home, | ||
tmp_root_prefix, | ||
tmp_env_name, | ||
tmp_xtensor_env, | ||
env_selector, | ||
explicit_flag, | ||
md5_flag, | ||
canonical_flag, | ||
): | ||
if env_selector == "prefix": | ||
res = helpers.umamba_list("-p", tmp_xtensor_env, explicit_flag, md5_flag) | ||
res = helpers.umamba_list("-p", tmp_xtensor_env, explicit_flag, md5_flag, canonical_flag) | ||
elif env_selector == "name": | ||
res = helpers.umamba_list("-n", tmp_env_name, explicit_flag, md5_flag) | ||
res = helpers.umamba_list("-n", tmp_env_name, explicit_flag, md5_flag, canonical_flag) | ||
else: | ||
res = helpers.umamba_list(explicit_flag, md5_flag) | ||
res = helpers.umamba_list(explicit_flag, md5_flag, canonical_flag) | ||
|
||
outputs_list = res.strip().split("\n")[2:] | ||
if explicit_flag == "--explicit": | ||
|
@@ -101,6 +109,12 @@ def test_list_explicit( | |
assert "#" in output | ||
else: | ||
assert "#" not in output | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a case where we have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is included in the |
||
else: | ||
if canonical_flag == "--canonical": | ||
items = ["conda-forge/", "::"] | ||
for output in outputs_list: | ||
assert all(i in output for i in items) | ||
assert " " not in output | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can maybe combine with |
||
@pytest.mark.parametrize("quiet_flag", ["", "-q", "--quiet"]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I just remembered that we can use
excludes
option inCLI11
to have the behavior we want:explicit_flag
being something like:auto* explicit_flag = subcom->add_flag("--explicit", explicit_.get_cli_config<bool>(), explicit_.description());
This way, no need to add
Ignored if --explicit.
in the description.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to let the user know the behavior of the commands, so not sure about removing the message.
Should I use
excludes
but leaveIgnored if --explicit.
in the description ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
excludes
automatically adds a note after the flag description in the--help
text (saying that it's excluding some flag/option). But yes you can try it out and do whatever you think is user friendly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it and I don´t think that it is the behavior we want as the command doesn´t run when using
excludes
. I will keep the initial version.