-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR adds an entry point for code widgets in the submission step, allowing users to add code widgets for their plugins. - Now, only the `pw` code is hardcoded. Other codes, e.g. `dos` and `projwfc`, are from the plugins. - The related code will be hidden if the workchain property is not selected.
- Loading branch information
1 parent
c8d1283
commit 229da06
Showing
7 changed files
with
147 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
def test_code_not_selected(submit_app_generator): | ||
"""Test if there is an error when the code is not selected.""" | ||
app = submit_app_generator() | ||
app.submit_step.codes["dos"].value = None | ||
app.submit_step._create_builder() | ||
|
||
|
||
def test_set_selected_codes(submit_app_generator): | ||
"""Test set_selected_codes method.""" | ||
from aiidalab_qe.app.submission import SubmitQeAppWorkChainStep | ||
|
||
app = submit_app_generator() | ||
submit_step = app.submit_step | ||
|
||
submit_step._create_builder() | ||
|
||
new_submit_step = SubmitQeAppWorkChainStep(qe_auto_setup=False) | ||
new_submit_step.set_selected_codes(submit_step.ui_parameters["codes"]) | ||
|
||
assert new_submit_step.get_selected_codes() == submit_step.get_selected_codes() | ||
|
||
|
||
def test_udpate_codes_visibility(): | ||
"""Test udpate_codes_visibility method. | ||
If the workchain property is not selected, the related code should be hidden. | ||
""" | ||
from aiidalab_qe.app.submission import SubmitQeAppWorkChainStep | ||
|
||
submit = SubmitQeAppWorkChainStep(qe_auto_setup=False) | ||
submit.udpate_codes_visibility() | ||
assert submit.codes["dos"].layout.visibility == "hidden" | ||
submit.input_parameters = {"workchain": {"properties": ["pdos"]}} | ||
submit.udpate_codes_visibility() | ||
assert submit.codes["dos"].layout.visibility == "visible" | ||
|
||
|
||
def test_identify_submission_blockers(app): | ||
"""Test identify_submission_blockers method.""" | ||
submit = app.submit_step | ||
blockers = list(submit._identify_submission_blockers()) | ||
# there is one blocker: ['The SSSP library is not installed.'] | ||
assert len(blockers) == 1 | ||
submit.input_parameters = {"workchain": {"properties": ["pdos"]}} | ||
blockers = list(submit._identify_submission_blockers()) | ||
assert len(blockers) == 1 | ||
# set dos code to None, will introduce another blocker | ||
submit.codes["dos"].value = None | ||
blockers = list(submit._identify_submission_blockers()) | ||
assert len(blockers) == 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters