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.
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
Cloud Pub/Sub Quickstart V2 #2004
Cloud Pub/Sub Quickstart V2 #2004
Changes from 2 commits
494d194
d6f6ea4
5828619
92929c3
c3768c4
1cdfb31
233d188
a1c303b
cb03cd1
b39898d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Prefer using the
monkeypatch
fixture for pytest. It can clean up after your tests so that the sleep function is restored after the test is done.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 need some help with this. In the meanwhile, since other tests are also written using
_make_sleep_patch
in the same repo, shall we start another PR just for this purpose?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.
This is the pattern I'm describing: https://stackoverflow.com/a/29110609/101923,
Now that I have a closer look,
mock.patch
does the same thing, but this still seems much more complicated than it needs to be.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 tried
monkeypatch
but it created an infinite loop.while True: time.sleep(60)
would calltime.sleep(10)
, which callstime.sleep(10)
and never reachesraise RuntimeError('sigil')
.