-
Notifications
You must be signed in to change notification settings - Fork 564
Demystify and deprecate HomeserverTestCase.pump() (Twisted reactor/clock)
#19602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
45d5867
Demystify `HomeserverTestCase.pump()`
MadLittleMods d5b1901
More comments
MadLittleMods ce303ec
Fix wording
MadLittleMods 9725854
Add changelog
MadLittleMods 838a808
Deprecate `pump()` and refactor wording
MadLittleMods 65efb52
Update changelog for deprecation
MadLittleMods 0a432d9
Use "steps" to better illustrate discrete increments
MadLittleMods 9547b8d
Advance time and run callbacks
MadLittleMods 32f2ce2
Merge branch 'develop' into madlittlemods/demystify-pump
MadLittleMods f79c3a4
Deferreds is a red herring
MadLittleMods 8ec4973
Merge branch 'develop' into madlittlemods/demystify-pump
MadLittleMods bf537ae
Specify `clock.call_later` only
MadLittleMods File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Update `HomeserverTestCase.pump()` docstring to demystify behavior (Twisted reactor/clock). |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Deprecate `HomeserverTestCase.pump()` in favor of more direct `HomeserverTestCase.reactor.advance(...)` usage. |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
though even if we signpost
advancemore, maybe deprecating pump is a bit far. Making people writefor _ in range(5): self.advance(0)in places may not necessarily make things more readable. Though in that case we could have a more explicit alternativeadvance_manywhere the100is replaced with an actual number.Hard to say.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My suspicion is that most
pump()usage is bogus. And in the cases where it does something, we really just need to advance time for a scheduled thing to happen.I'm ok with moving forward with deprecating as it encourages bad behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm coming around to this, yes let's deprecate it. Advancing 100 times internally 'just because' feels like bad practice to me.
I'd rather have a wrapper around
advanceor some such.
require_calls(true by default) would assert that there is actually something to progress. I am not sure whether to define that to mean 'there is something on the queue' or (stronger) 'there is something on the queue that actually gets executed by this advance call'.But this is derailing this PR, so let's leave it for later (maybe I have a crack at this later today for the curiosity)