-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
ClientSession.close() is a coroutine warning #2209
Comments
Thus you need add lines for explicit session closing maybe? |
that's just it, i don't have any client session code to close. At least not
that I know of.
Patrik
Den 17 aug 2017 20:44 skrev "Andrew Svetlov" <[email protected]>:
… Thus you need add lines for explicit session closing maybe?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2209 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AUIB0UPj_vowjY4x77hsGVHJyMPdO7Jiks5sZIoNgaJpZM4O4muC>
.
|
Do you use plain |
My tests look more like this as an example request = await self.client.request("GET", "/api/v1/targets")
self.assertEqual(request.status, 200)
text = await request.text()
self.assertEqual("[]", text) I guess that self.client.request could be a aiohttp.request under the hood. Attaching part of my code base to hopefully clarify what i'm doing in test.zip Searching through my code base for the string session, disregarding case, comes up with nothing. |
I can see if i can scale down the code enough to get the issue unless you beat me to it. |
Interestingly enough it seems to be enough with the code in the testing documentation to trigger the error. There is no need to satisfy test tests. It just warn immediately. Attaching the code i tried just now. See testcode.zip What i get when i run is $ python3 -m unittest
/usr/local/lib/python3.5/dist-packages/aiohttp/helpers.py:139: DeprecationWarning: ClientSession.close() is a coroutine
warnings.warn(self._msg, DeprecationWarning)
E
======================================================================
ERROR: test_example (test_foo.MyAppTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
[...]
NameError: name 'root' is not defined
----------------------------------------------------------------------
Ran 1 test in 0.043s
FAILED (errors=1) Notice the deprecation warning in the beginning of the output. So i cannot see there is anything weird with what I'm doing. I seem to get the Deprecation waring because _CoroGuard wasn't awaited upon. This is discovered in _CoroGuard.del(). |
Do you have any ideas how to fix this? |
Got same warning.
After first lines execution I got:
But it seems, something already changed in master branch: haven't tested it yet |
I found the source of the problem: So a temporary workaround would be:
So I guess we should just wait for a new version release. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
Long story short
I get a deprecation warning in aiohttp 2.2.5 which mess up Vim's quickfix window
Expected behaviour
No deprecation warning
Actual behaviour
The code seems to work but i get this deprecation warning each time i run my tests.
My tests are based on the unittest package from Python stdlib.
Steps to reproduce
I run tests using AioHTTPTestCase and unittest_run_loop from aiohttp.test_utils
I don't have any line that close any session in my tests so i guess that the warning comes from the aiohttp library.
Your environment
% pip3 freeze | grep aio aio-pika==0.18.0 aiodns==1.1.1 aiohttp==2.2.5
I'm running Python 3.5.2 using async and await syntax.
The text was updated successfully, but these errors were encountered: