-
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
Migrate verdi computer disable/enable to click #1716
Migrate verdi computer disable/enable to click #1716
Conversation
For now only converted enable and disable, tests added.
ups... didn't realize there were already some tests for the old cli interface. I'm going to remove them. |
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.
Minor changes, you can disregard the comments about using echo_critical
instead of print >> stderr
because I forgot that you weren't converting everything. Did you add these files to pre-commit or will we wait until full command is migrated?
from aiida.common.exceptions import NotExistent | ||
|
||
|
||
# pylint: disable=missing-docstring |
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.
pylint disable does not seem necessary here? Even more so given that these files have not been added to pre-commit yet?
""" | ||
|
||
@classmethod | ||
def setUpClass(cls, *args, **kwargs): |
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 base AiidaTestCase
already provides a computer
class property. If this computer is just a base stud, maybe you could that one to avoid duplication
except KeyError: | ||
print >> sys.stderr, ("Internal error! " | ||
"No {} getter defined in Computer".format(getter_name)) | ||
print >> sys.stderr, ("Internal error! " "No {} getter defined in Computer".format(getter_name)) |
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.
print with aiida.cmdline.utils.echo
based functions. the echo_critical
will automatically print to stderr and exit
except KeyError: | ||
print >> sys.stderr, ("Internal error! " | ||
"No {} setter defined in Computer".format(setter_name)) | ||
print >> sys.stderr, ("Internal error! " "No {} setter defined in Computer".format(setter_name)) |
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.
see above about echo
echo.echo_info("Computer '{}' already disabled.".format(computer.name)) | ||
else: | ||
computer.set_enabled_state(False) | ||
echo.echo_info("Computer '{}' disabled.".format(computer.name)) |
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.
Maybe for the cases where the (desired) change is actually effectuated, it would be good to use echo_success
instead of echo_info
?
I temporarily added it to at least fix the formatting, but there were too many problems with prospector that will be anyway solved when finishing the conversion, so I disabled it for now. |
(old test removed/replaced, and the verdi computer test moved to the right file)
hi guys, do you have an idea why the tests are failing?
|
probably I had committed with a different version?
I added a |
Codecov Report
@@ Coverage Diff @@
## verdi #1716 +/- ##
==========================================
+ Coverage 61.26% 61.28% +0.02%
==========================================
Files 300 300
Lines 33541 33518 -23
==========================================
- Hits 20550 20543 -7
+ Misses 12991 12975 -16
Continue to review full report at Codecov.
|
This is a partial migration of verdi computer (see #1582).
Focuses on
enable
anddisable
only, tests added.I extracted the work I was doing in a different branch to isolate only the changes to disable/enable, and allow other people to help with the commands.
I will take care in a different PR of the interactive commands (setup and configure).