Skip to content
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

Test and update the wizard module #466

Merged
merged 10 commits into from
Mar 23, 2023
Merged

Conversation

yakutovicha
Copy link
Member

@yakutovicha yakutovicha commented Mar 22, 2023

fixes #461
fixes #343

@yakutovicha yakutovicha requested a review from unkcpz March 22, 2023 17:13
@codecov
Copy link

codecov bot commented Mar 22, 2023

Codecov Report

Patch coverage: 97.26% and project coverage change: +1.90 🎉

Comparison is base (3b7aff7) 77.41% compared to head (35756f1) 79.32%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #466      +/-   ##
==========================================
+ Coverage   77.41%   79.32%   +1.90%     
==========================================
  Files          26       27       +1     
  Lines        3626     3685      +59     
==========================================
+ Hits         2807     2923     +116     
+ Misses        819      762      -57     
Flag Coverage Δ
python-3.10 79.32% <97.26%> (+1.90%) ⬆️
python-3.8 79.35% <97.26%> (+1.88%) ⬆️
python-3.9 79.35% <97.26%> (+1.88%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
tests/test_wizard.py 96.42% <96.42%> (ø)
aiidalab_widgets_base/wizard.py 92.45% <100.00%> (+57.50%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yakutovicha thanks! only some minor requests.

BTW, Is that possible to address #343 here?
The issue seems caused from when the accordion widget has all steps folder, the selected_index can be None, when status of a step widget is reset, it triggers widget update and hint at the exception.

    # last step success and reset (To mimic new workflow in QeApp)
    assert s1.state == s1.State.SUCCESS
    widget.accordion.selected_index = None
    s1.state = s1.State.INIT # this will trigger the update method and hint the problem

Comment on lines 124 to 125
if not testing: # pytest is hanging if we start a thread
threading.Thread(target=spinner_thread).start()
Copy link
Member

@unkcpz unkcpz Mar 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if not testing: # pytest is hanging if we start a thread
threading.Thread(target=spinner_thread).start()
self.spinner_thread = threading.Thread(target=spinner_thread).start()

The thread can be stop and joined in the test explicitly. It is also good to leave a handler attribute to get control of inner thread.

Copy link
Member Author

@yakutovicha yakutovicha Mar 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you do that? I tried the following, but it didn't work:

self.spinner_thread._stop()

The only working option I could think of is do something like so:

        self._run_update_thread = True
        def spinner_thread():
            while self._run_update_thread:
                time.sleep(0.1)
                self._update_titles()

        threading.Thread(target=spinner_thread).start()

Copy link
Member

@unkcpz unkcpz Mar 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try self.spinner_thread.join() this will wait for the thread to stop and finish. We did it here https://github.com/aiidalab/aiidalab/blob/50498b08ea77937cb8af0e8d753446dd17b6d637/tests/test_appclass.py#L87-L104
we can try together.

Copy link
Member Author

@yakutovicha yakutovicha Mar 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try self.spinner_thread.join() this will wait for the thread to stop and finish. We did it here https://github.com/aiidalab/aiidalab/blob/50498b08ea77937cb8af0e8d753446dd17b6d637/tests/test_appclass.py#L87-L104 we can try together.

The problem is that the current loop is infinite:

while True:
    ....

So there is no reason for it to stop. And calling _stop() didn't stop it, it just excepted.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 35756f1

tests/test_wizard.py Show resolved Hide resolved
tests/test_wizard.py Show resolved Hide resolved
@yakutovicha yakutovicha requested a review from unkcpz March 23, 2023 11:13
Copy link
Member

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Looks all good to me.

@unkcpz unkcpz merged commit f3fdff2 into master Mar 23, 2023
@unkcpz unkcpz deleted the chore/test-and-update-wizard-module branch March 23, 2023 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test the wizard module WizardAppWidgetStep excepts under some conditions
2 participants