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

Improve testing of save and export functionality #120

Open
adamltyson opened this issue Jul 11, 2023 · 1 comment
Open

Improve testing of save and export functionality #120

adamltyson opened this issue Jul 11, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@adamltyson
Copy link
Member

The testing of the GUI functionality is a bit hacky. There are sleep() calls, and we don't test the button clicking and the desired functionality separately.


Based on comments in #114 by @alessandrofelder:

I think a better long-term solution would be to:

  • mock the brainreg_segment.segment.run_save() function in these tests, and check that it's called with the expected parameters
  • write unit tests for run_save() and/or export_all()
    • tests for run_save could again mock export_all to avoid those tests being non-deterministic due to multiprocessing
    • tests for export_all could mock the thread_worker decorator to render it trivial and have export_all run in the same thread. (we trust thread_worker is tested sufficiently in the third party library it comes from and so don't need to test it)

This would ensure cleaner separation between

  • the tests that check that clicking GUI buttons call the expected functionality
  • the tests that call multiprocessing functionality
  • the tests that check the multiprocessing functionality itself
@adamltyson adamltyson added the enhancement New feature or request label Jul 11, 2023
@adamltyson adamltyson self-assigned this Jul 11, 2023
@alessandrofelder
Copy link
Member

https://pytest-qt.readthedocs.io/en/latest/signals.html might also be useful in this context!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Planned
Development

No branches or pull requests

2 participants