-
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
The computer configure command include profile if not in the current profile #5259
The computer configure command include profile if not in the current profile #5259
Conversation
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 @unkcpz , makes sense to me. Would maybe just suggest to always include the profile in the suggested command. Makes it consistent and also makes the code simpler.
a39792f
to
c92e51b
Compare
@sphuber Thanks! |
Codecov Report
@@ Coverage Diff @@
## develop #5259 +/- ##
===========================================
- Coverage 81.46% 81.46% -0.00%
===========================================
Files 530 530
Lines 37113 37116 +3
===========================================
- Hits 30232 30231 -1
- Misses 6881 6885 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Thanks a lot @unkcpz that's great. One possible reason for the hanging is that some of the tests are running the commands that open an editor to enter the prepend and append text. To fix this, you need to use a special fixture which will automatically close the editor. You will find an example at the bottom of the file of a test that was already in pytest form:
|
35ba257
to
e277e44
Compare
@pytest.mark.parametrize('non_interactive_editor', ('vim -cwq',), indirect=True) | ||
def test_computer_duplicate_interactive(run_cli_command, comp, non_interactive_editor): |
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.
Hi @sphuber , thanks for the advice. I add the fixture but seems not work. Maybe is the problem is the user_input
is wrong? Because for the next test_computer_duplicate_non_interactive
test, I need to pass --hostname=localhost
, where this hostname
is a required parameter for the verdi computer duplicate
.
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 test that seems to be hanging though is test_computer_test
. That is part of a class that you haven't converted to pytest
yet (although you did change it from self.assertTrue
to assert
). I am not sure, but maybe the fact that you are mixing two styles is causing the problem?
Edit: scratch that, that test actually completes. Weirdly enough the logs don't say what test is run after and so which one seems to be blocking.
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 found the problem and pushed a commit with the fix. See commit message for details
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.
@sphuber Cool! I spend half an hour and cannot find how to fix this. Super thanks.
I rebased the commits and fix the pre-commit error.
Fixes aiidateam#4679 When setup computer for not the current profile by `-p <profile>`, the proposed message for computer configure command does not contain this profile name, which lead to the copy paste of the proposed message for configure commad not apply to the correct profile. We read the profile name from ctx.obj and pass it to the proposed configere message. - Some of unittests in test_computer.py are moved to pytest.
The problem was that the computer that was being duplicated did not define the `default_mpiprocs_per_machine`, but the `user_input` just provided enters. Since there was no default, it kept prompting. By setting the `default_mpiprocs_per_machine` on the computer that is being duplicated, the problem is fixed. Note that this is done on the `aiida_localhost` fixture from the `conftest.py`. This allows to remove the ad-hoc fixture `comp` which was doing exactly the same.
dc13287
to
396229a
Compare
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 @unkcpz
Fixes #4679
If setup computer for another profile with
-p <profile_name>
when it is not the current default profile, the prompt hint for setting the computer configure will now include the-p <profile_name>
.