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
[tests] conda_env create tests confuse -f and -n #8468
Conversation
…e -n not -f. Signed-off-by: Brett Randall <javabrett@gmail.com>
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.
Thanks for looking into this. I'm pretty sure you're right, but I'll spend a bit more time double-checking the positional arg stuff.
@@ -83,7 +83,7 @@ def run_env_command(command, prefix, *arguments): | |||
arguments[1:1] = ['-n', prefix] | |||
elif command is Commands.ENV_CREATE: # CREATE | |||
if prefix: | |||
arguments[1:1] = ['-f', prefix] | |||
arguments[1:1] = ['-n', prefix] |
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 we should test prefix
to see if it is path-like (has slashes, leading periods, is an abspath, etc.). If it is a path, this should be -p. If it's a name, it should be -n.
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 hadn't considered -p
. It's also possible I'm not across any overloaded meaning of the terms prefix
and name
, which are used interchangeably in the code in places.
None of the existing tests make use of -p
, so there might be some coverage options there. Hopefully none of the existing tests pass a path-type -n
- this arg is positional prefix
, or so it seems.
Existing tests are mostly creating by name and file, but important to test that the name takes priority in the created env I guess. Just looked wrong that the prefix was passed to file in this one case, and test callers were bent to fit that.
Eventually these tests need to point out issues in
conda/conda_env/specs/__init__.py
Lines 15 to 18 in 9a303dc
def detect(**kwargs): | |
filename = kwargs.get('filename') | |
remote_definition = kwargs.get('name') | |
... where remote def and name might be passed in a single kwarg without being able to distinguish between them, causing logic issues in that method.
@javabrett has signed the CLA. Thanks for your contribution! |
Hi there, thank you for your contribution to Conda! This pull request has been automatically locked since it has not had recent activity after it was closed. Please open a new issue or pull request if needed. |
When a prefix is passed to
run_env_command
withCommands.ENV_CREATE
it should be passed to-n
, not-f
. Fixed that and corrected tests calling that helper method.Noticed while investigating #8192.