-
Notifications
You must be signed in to change notification settings - Fork 192
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
Unpin the click
dependency
#3921
Conversation
2942ab2
to
039b7bb
Compare
Codecov Report
@@ Coverage Diff @@
## develop #3921 +/- ##
========================================
Coverage 78.20% 78.21%
========================================
Files 460 460
Lines 34027 34035 +8
========================================
+ Hits 26611 26619 +8
Misses 7416 7416
Continue to review full report at Codecov.
|
/update-requirements |
Starting 'update-requirements' workflow for this branch. |
e690333
to
3a7c2e6
Compare
bf031a5
to
cc7c0a0
Compare
@ltalirz @greschd and @csadorf note that in the first commit I fix the version of |
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 @sphuber !
I have a few comments & questions
tests/cmdline/commands/test_code.py
Outdated
assert isinstance(Code.get_from_string('{}@{}'.format(label, aiida_localhost.name)), Code) | ||
|
||
|
||
@pytest.mark.skip('This test is hanging for some reason.') |
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.
Can this be fixed?
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 fixing it but I had even trouble understanding what the problem was. The problem was that the test hangs and you get no output. By changing the click
source and setting default of resilient_parsing=False
for the Context
at least it printed a warning. Apparently the CodeBuilder
was flagging an issue saying that properties were specified for a "remote" code even though it thinks that it concerns a local one. This is weird, because in the test what we are duplicating is a "remote" code. Anyway, I find the code of the CodeBuilder
a bit hard to follow and I could not figure out why now all of a sudden it was complaining when I am just switching to a different manner of running the test and the test itself remaining essentially unchanged. Would be great if you may have some pointers, since I think you are the original author of the CodeBuilder
.
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.
since I think you are the original author of the CodeBuilder
I think this honor belongs to Rico, in 6873af9 .
However perhaps the issue is indeed in the lines I added for code duplication?
E.g. that the Code.get_code_spec
function forgets to set some property?
aiida-core/aiida/orm/utils/builders/code.py
Lines 88 to 115 in 0644e7d
@staticmethod | |
def get_code_spec(code): | |
"""Get code attributes from existing code instance. | |
These attributes can be used to create a new CodeBuilder:: | |
spec = CodeBuilder.get_code_spec(old_code) | |
builder = CodeBuilder(**spec) | |
new_code = builder.new() | |
""" | |
spec = {} | |
spec['label'] = code.label | |
spec['description'] = code.description | |
spec['input_plugin'] = code.get_input_plugin_name() | |
spec['prepend_text'] = code.get_prepend_text() | |
spec['append_text'] = code.get_append_text() | |
if code.is_local(): | |
spec['code_type'] = CodeBuilder.CodeType.STORE_AND_UPLOAD | |
spec['code_folder'] = code.get_code_folder() | |
spec['code_rel_path'] = code.get_code_rel_path() | |
else: | |
spec['code_type'] = CodeBuilder.CodeType.ON_COMPUTER | |
spec['computer'] = code.get_remote_computer() | |
spec['remote_abs_path'] = code.get_remote_exec_path() | |
return spec |
Anyhow, since Codes are now Nodes, perhaps this function is basically obsolete and one could simply clone the original Code instead?
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.
Replacing this with a clone
is probably still a valid point, perhaps open an issue for this if you agree?
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 was going to, but it does quite a bit more then just providing the functionality that clone
does. It also provides all the validation and a way for the contextual defaults to be set in the CLI, so I am not sure that we can actually get rid of it.
cc7c0a0
to
c46e55a
Compare
@ltalirz I fixed the hanging test and in doing so tackled another issue #3810 . If you are happy with the changes let me know, then I will rebase and revert the requirements to |
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 @sphuber - I have some minor comments.
Anyhow, you can also proceed and merge this as is.
c46e55a
to
9131f0b
Compare
This was pinned because `7.1` broke our pre-commit hooks. The breaking of the tests was caused by two separate commits: * 718485be48263056e7036ea9a60ce11b47e2fc26 * 37d897069f58f7f2a016c14b0620c6d387430b4b The first one changes the format of the output of a command if a required option is missing. The double quotes around the option have been changed to single quotes. The second commit is more pernicious: the `Editor.edit_file` method was updated to escape the editor and filename parameters passed to the sub process call. Our tests were abusing the absence of escaping to pass arguments to the editor command, in our case `vim`, as to make the normally interactive command a non-interactive one for testing purposes. Now that the editor command is escaped, the arguments are understood by bash to be part of the command which of course then cannot be found and the test fails. We "fix" this problem by patching the changed method in `click` to undo the escaping.
9131f0b
to
76ed3f6
Compare
Fixes #3838
Fixes #3810
The breaking of the tests was caused by two separate commits:
The first one changes the format of the output of a command if a
required option is missing. The double quotes around the option have
been changed to single quotes.
The second commit is more pernicious: the
Editor.edit_file
method wasupdated to escape the editor and filename parameters passed to the sub
process call. Our tests were abusing the absence of escaping to pass
arguments to the editor command, in our case
vim
, as to make thenormally interactive command a non-interactive one for testing purposes.
Now that the editor command is escaped, the arguments are understood by
bash to be part of the command which of course then cannot be found and
the test fails. We "fix" this problem by patching the changed method in
click
to undo the escaping.