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.
I like the changes to SignalBlocker. That is a great, simple way to check if the signal was called.
One note about the context manager: the point of the context manager is to connect the signal(s) before some operation that fires signals begins. For example, if we call
worker.run()
before connecting the signals, there is a race condition; the signals might fire before the loop is executed, and we will have to use the timeout.Also, the example doesn't look correct. The
assert blocker.signal_triggered
will fail becausewait()
is not called until thewith
statement exits. I would change the example in the docs to this:Other than changing the example, I think the explanation in the docs is great, and your refactoring of the tests and code looks awesome!