Repository navigation
Add GUI widget tests and fix notify calls in qtitem_store - #843
Merged
smathot merged 1 commit intoDec 1, 2026
Merged
Conversation
hieudoanm
force-pushed
the
add-gui-webbrowser-tests
branch
from
November 24, 2026 11:28
98c23ee to
7cad9ad
Compare
…ython cache artifacts
hieudoanm
force-pushed
the
add-gui-webbrowser-tests
branch
from
November 29, 2026 10:29
a16018d to
2f75015
Compare
Collaborator
|
Thanks for your work again! 👍 I've seen that you did some work on this PR after opening it. Is it ready to be reviewed/ merged? (For future reference, it's best to open the PR only once you're satisfied that it's ready for review. Or alternatively, to open it with a clear indication that it's WIP and then give me a clear ping once it's ready.) |
Contributor
Author
|
Yes, it is ready to be reviewed and merged, @smathot! I have to re-push because the CI failed the first time due to GitHub being flaky/inconsistency! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
libqtopensesamehad almost no test coverage (~5%), and several recent GUI fixes shipped without regression tests — including the embedded-browser help commands (#838), the item-tree crash on rebuild (#836), and the item copy/paste insertion path. Writing these tests also exposed a real bug:QtItemStore.rename()calledself.notify()on its failure paths, butQtItemStorehas nonotifyattribute, so renaming a nonexistent item raisedAttributeErrorinstead of showing the intended notification.Solution
Add three test modules to
tests/gui/that boot a realQtOpenSesamewindow offscreen (QT_QPA_PLATFORM=offscreen, analytics extension disabled, code-editor worker pool disabled) and exercise the widgets the application actually uses:test_webbrowser.py—Webbrowser.command()forhelp plugin <name>,help extension <name>(the Fix help extension/plugin command in embedded browser #838 fix: folder resolution and.mdloading) andhelp <topic>routing toopen_helptest_tree_overview.py— overview tree population, item selection, rename through theitemChanged/text_editedpath, fold state, unused items, copy→paste throughdrop_event_item_new(the same insertion code as drag-and-drop, adjacent to the Error when making an unlinked copy in the experiment tree #836 fix), child deletion with full tree rebuild, and permanent deletiontest_item_store.py—qtitem_storeitem creation (including themissing_itemfallback for unloadable plugins), renaming with tree/experiment sync and unsaved flag, rename edge cases, andMarkdownParser.to_html()/highlight()used for.mdhelp pagesAlso fixes
qtitem_store.py:self.notify(...)→self.main_window.notify(...)on the three rename-failure paths.Coverage impact
libqtopensesame/misc/qtitem_store.py→ 90%libqtopensesame/misc/markdown_parser.py→ 85%libqtopensesame/widgets/webbrowser.py→ 64%libqtopensesame/widgets/tree_item_item.py→ 63%libqtopensesame/widgets/tree_overview.py→ 40%Why these tests?
QtOpenSesamewindow, real plugin/extension managers, real item store and tree widgets — not mocks of the units under test.QMessageBox) are mocked where needed.setUpClass(pyqt_code_editor.worker.manager.start_worker_pool), since the tests don't use the code editor and the spawned worker processes are unneeded.Test plan
pytest tests/gui— 18 passed locally (~3s)test_help_plugin/test_help_extensionverified to fail withNameErroron the pre-Fix help extension/plugin command in embedded browser #838 codetest_rename_item_failuresverified to expose theself.notifyAttributeErrorbefore the fix