Repository navigation
test: dispose canvases after every GUI test; classmethod qapp fixture - #190
Merged
Merged
Conversation
The per-test hygiene now closes and deletes, with Qt, every parentless DiagramView the test built (views from wider-scoped fixtures, views inside a window and views a fixture already deleted are left alone), so no shown canvas is left for gc.collect() to tear down in an unsafe order. The module-scoped qapp fixture in test_start_to_end_and_units.py becomes a classmethod, clearing PytestRemovedIn10Warning.
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.
Closes 189
tests/conftest.py:_dispose_new_viewsruns in the per-test hygiene. It closes anddeleteLater()s every parentlessDiagramViewbuilt during the test and drainsDeferredDelete, so Qt frees it in its own order instead ofgc.collect()doing it (the segfault seen on Filter row for large results tables and the Data Tables #172 and Data Tables: Whole model, multi-row edit, button spacing; document the filters #176). Views that existed before the test (module/class fixtures), views inside a window (_reaphandles those) and views a fixture already deleted are skipped.tests/unit/test_view_disposal_hygiene.py: four tests for that step (fails without it).tests/unit/test_start_to_end_and_units.py: the module-scopedqappfixture is a@classmethod(clearsPytestRemovedIn10Warning).The per-file cleanups in test_gui_tool_cursor.py and test_routing_nodes.py are left as they are; they are harmless alongside this.
Ran locally: all 49 files that build a
DiagramView, with the deprecation warning as an error for the touched ones. ruff and the mypy gate are clean.