tests: refactor the Qt test harness to support running QObject's within a QCoreApplication#10699
Open
accumulator wants to merge 3 commits into
Open
tests: refactor the Qt test harness to support running QObject's within a QCoreApplication#10699accumulator wants to merge 3 commits into
accumulator wants to merge 3 commits into
Conversation
Member
Author
|
Interesting. These new Qt testcases unearthed a pre-existing bug. There are some lifecycle issues with some QObject subclasses (in particular I'll submit fixes in another PR. |
…in a QCoreApplication and its event loop, so we can fully test behaviour with more complex QObject hierarchies and check for signal emits add some initial tests for QEWallet
A qt_test body runs inside app.exec() (one loop level deep, via doInvoke), so a QObject.deleteLater() posted there is never delivered by processEvents() -- Qt only delivers DeferredDelete once the loop unwinds to the level at which it was posted. The C++ objects, and everything they reference (e.g. a QEWallet's self.wallet), lingered until some later, racy spin of the loop. Flush them synchronously via sendPostedEvents(None, DeferredDelete), then gc.collect() so reference cycles (e.g. wallet<->txbatcher) are reclaimed and their EventListener.__del__ unregisters callbacks. This keeps QML tests from leaking wallet objects and callbacks into later tests (e.g. test_daemon's GC sanity checks). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
bfb1569 to
ba358b1
Compare
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.
tests: refactor the
Qttest harness to support runningQObject's within aQCoreApplicationand its eventloop, so we can fully test behaviour with more complex
QObjecthierarchies and check for signal emits.adds some initial tests for
QEWallet