Repository navigation
Various testCancel's : Replace with simpler test that is more reliable - #1575
Open
danieldresser-ie wants to merge 1 commit into
Open
danieldresser-ie wants to merge 1 commit into
danieldresser-ie wants to merge 1 commit into
Conversation
johnhaddon
reviewed
Nov 17, 2026
johnhaddon
left a comment
Member
There was a problem hiding this comment.
Sorry it took me so long to get to this one @danieldresser-ie. LGTM, although I think it's worth cleaning up the empty regexes before merging.
|
|
||
| self.assertLess( time.time() - startTime, 0.1 if IECore.isDebug() else 0.06 ) | ||
| self.assertTrue( cancelled[0] ) | ||
| with self.assertRaisesRegex( IECore.Cancelled, "" ): |
Member
There was a problem hiding this comment.
Why use assertRaisesRegex() with an empty regex? Why not just use assertRaises()? Same comment applies to the other tests too...
danieldresser-ie
force-pushed
the
simpleTestCancel
branch
from
November 17, 2026 17:03
d8f0b2b to
bd052b8
Compare
Contributor
Author
|
Fixed asserts and squashed. |
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.
The previous
testCancelimplementation used a second Python thread and a timer to send a cancellation that should arrive when once the target function was actually in the meat of the compute. This wasn't very reliable though - we were only testing cancellation at one point in time, and depending on how long the Python thread took to actually start, we might be testing cancellation at the very beginning of the target function. This test was also quite unreliable ( for reasons I honestly don't fully understand ) - we'd already disabled it when inMacCI(), but we were also seeing occasional failures in our Linux CI ( and quite frequently in ImageEngine's CI ).John suggested that it would make sense to replace this with a simpler test that just makes sure cancellation is checked somewhere in the target function. This does not give us particularly good coverage ( if there is a Canceller::check() at the beginning, then this test will always pass, even if Canceller::check() is missing inside heavy loops where it's really needed ), but the coverage wasn't great anyway, and this test is much simpler and more reliable.