-
Notifications
You must be signed in to change notification settings - Fork 48
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
Fix up Python 3.8 loop argument warnings #246
Conversation
* Remove all "loop=self.loop" expressions. * Rely on the currently running loop in the constructor of Queue. * Assuming that janus.Queue objects are created in the functions or coroutines called by the event loop, rewrite most test cases to be async. - No longer manage the event loop lifecycles by ourselves. - Adopt pytest-asyncio to seamlessly run test cases in an event loop. * Add missing .close() / .wait_closed() calls to the end of many test cases to ensure proper termination of the queues. * Insert asyncio.sleep(0) in the wait_closed() method so that all task-done callbacks for tasks spawned by _notify_async_not_empty(), _notify_async_not_full() internal methods are properly awaited. This eliminates hundreds of resource warnings after finishing the test suite. * Ensure dropping of Python 3.3/3.4 in CI configs. * Add Python 3.7 and 3.8 to CI configs.
Codecov Report
@@ Coverage Diff @@
## master #246 +/- ##
=======================================
Coverage 99.67% 99.67%
=======================================
Files 1 1
Lines 308 309 +1
Branches 40 41 +1
=======================================
+ Hits 307 308 +1
Partials 1 1
Continue to review full report at Codecov.
|
* Remove PY_33/PY_35 conditional branches as we no longer support Python 3.4 or older versions.
@asvetlov Just a poke, please have a look at this PR. |
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.
Awesome!
Very impressive work, thanks!
What do these changes do?
loop=self.loop
expressions.janus.Queue
objects are created in the functions or coroutines called by the event loop, rewrite most test cases to be async..close()
/.wait_closed()
calls to the end of many test cases to ensure proper termination of the queues.asyncio.sleep(0)
in thewait_closed()
method so that all task-done callbacks for tasks spawned by_notify_async_not_empty()
,_notify_async_not_full()
internal methods are properly awaited.This eliminates hundreds of resource warnings after finishing the test suite and loop termination after using
.join()
APIs.Are there changes in behavior for the user?
Users are no longer able to create
janus.Queue
instances in the codes running outside event loops (even when they have references to an existing event loop running somewhere else).Related issue number
#229
Checklist
CHANGES
folderCHANGES
folder, so I've added a bullet inCHANGES.rst
directly.