-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
PYTHON-4763 Migrate test_change_stream.py to async #1853
Conversation
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.
The async test_change_stream.py
file is missing?
test/test_change_stream.py
Outdated
@@ -310,7 +312,7 @@ def _test_next_blocks(self, change_stream): | |||
@no_type_check | |||
def test_next_blocks(self): | |||
"""Test that next blocks until a change is readable""" | |||
# Use a short await time to speed up the test. | |||
# Use a short time to speed up the test. |
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.
# Use a short time to speed up the test. | |
# Use a short wait time to speed up the test. |
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.
changed :)
test/test_change_stream.py
Outdated
@@ -325,7 +327,7 @@ def test_aggregate_cursor_blocks(self): | |||
@no_type_check | |||
def test_concurrent_close(self): | |||
"""Ensure a ChangeStream can be closed from another thread.""" | |||
# Use a short await time to speed up the test. | |||
# Use a short time to speed up the test. |
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.
# Use a short time to speed up the test. | |
# Use a short wait time to speed up the test. |
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.
The async test_change_stream.py
file is missing?
omg one sec, i always forget that -a doesn't add the file... ;-; |
like fifty attempts later, its ready HAHA |
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.
A few minor comments, otherwise looks great!
@@ -158,10 +162,14 @@ def test_try_next(self): | |||
with self.change_stream(max_await_time_ms=250) as stream: | |||
self.assertIsNone(stream.try_next()) # No changes initially. | |||
coll.insert_one({}) # Generate a change. | |||
|
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.
Unneeded added space here.
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.
Yeah...I'll try again for sure, but i tried to delete it and when i ran pre-commit it was added again??? not sure why though
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.
Because the async file overwrites the sync one
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.
ohh, I think it is because ruff is just doing that because the file has changed
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.
yeah so I found the space in the async file, deleted it, and then it got added back during pre-commit
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.
Ah in that case never mind, if the formatter adds an extra space that's fine.
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.
perfect, because I just gave up on trying to convince it otherwise
test/test_change_stream.py
Outdated
wait_until(lambda: stream.try_next() is not None, "get change from try_next") | ||
|
||
def _wait_until(): | ||
return stream.try_next() |
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.
return stream.try_next() | |
return stream.try_next() is not None |
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.
fixed :)
test/test_change_stream.py
Outdated
wait_until(lambda: stream.try_next() is not None, "get change from try_next") | ||
|
||
def _wait_until(): | ||
return stream.try_next() |
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.
return stream.try_next() | |
return stream.try_next() is not None |
No description provided.