PlugValueWidgetTest : Fix handling of background updates - #7081
Open
johnhaddon wants to merge 2 commits into
Open
PlugValueWidgetTest : Fix handling of background updates#7081johnhaddon wants to merge 2 commits into
johnhaddon wants to merge 2 commits into
Conversation
Member
Author
|
Looks like I failed to notice that other tests were using |
johnhaddon
force-pushed
the
plugValueWidgetTestFixes
branch
from
August 7, 2026 11:28
d58e136 to
c4933b7
Compare
Member
Author
|
I've pushed a new version which should take care of the other spots that use It uses a new central |
This has a few benefits : - We can simplify a few tests which were making their own handlers. - It is more robust to badly behaved tests that don't handle UI thread calls. By catching them in our own handler, we prevent them spilling into the next test, where a call to `waitForIdle()` might trigger them unexpectedly. - In future, we can add an assertion that all tests are correctly handling calls. - It enables a race-free replacement for `PlugValueWidgetTest.waitForUpdate()`, to appear in the next commit.
This fixes test failures that looked like this :
```
Traceback (most recent call last):
File "D:\a\gaffer\gaffer\build\python\GafferUITest\PlugValueWidgetTest.py", line 453, in testContextTrackerUpdates
self.waitForUpdate( widget )
File "D:\a\gaffer\gaffer\build\python\GafferUITest\PlugValueWidgetTest.py", line 62, in waitForUpdate
handler.assertCalled()
File "D:\a\gaffer\gaffer\build\python\GafferTest\ParallelAlgoTest.py", line 92, in assertCalled
self.receive( timeout )()
^^^^^^^^^^^^^^^^^^^^^^^
File "D:\a\gaffer\gaffer\build\python\GafferTest\ParallelAlgoTest.py", line 86, in receive
raise AssertionError( "UIThread call not made within {} seconds".format( timeout ) )
AssertionError: UIThread call not made within 30.0 seconds
```
Our old approach of calling `waitForUpdate()` after running the code to trigger the update was bogus -
it was possible for the update to have finished before we even got to calling `waitForUpdate()`.
By using the already-scoped `self.uiThreadCallHandler` instead of making a temporary one, we avoid this race condition.
johnhaddon
force-pushed
the
plugValueWidgetTestFixes
branch
from
August 7, 2026 12:20
dae724b to
74b63c2
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.
This fixes test failures that looked like this :
Our old approach of calling
waitForUpdate()after running the code to trigger the update was bogus - it was possible for the update to have finished before we even got to callingwaitForUpdate(). By triggering the update from inside the UIThreadCallHandler's scope we avoid this possibility.