-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Added Python 3.5 “async for” compat to websocket #543
Conversation
uh, those test failures are no my fault. i fixed them in #544 |
triggering rebuild |
hmm, OK, now the error is: $ flake8 aiohttp
aiohttp/web_ws.py:297:19: F821 undefined name 'StopAsyncIteration' but this is wrong. of course this is an undefined name in python < 3.5, but as you’d have to call so i’ll just make flake8 shut up. |
Tests and documentation update are required |
i don’t seem to get this test to run. it hangs, don’t know why… |
In Travis log: |
i know, i just made a last-minute fix and didn’t run it after 😐 check the new one, that’s the real problem. |
401f1e3
to
48ae89e
Compare
Seems hangs on msg = await resp._reader.read() In yield from self._waiter It stops there I guess... |
ya. why? |
Here is the part of the my testing in items = ['q1', 'q2', 'q3']
for item in items:
resp._writer.send(item)
msg = await resp._reader.read()
assert msg.tp == websocket.MSG_TEXT
assert item + '/answer' == msg.data
resp._writer.close()
msg = await resp._reader.read()
assert msg.tp == websocket.MSG_CLOSE
assert msg.data == 1000
assert msg.extra == ''
await closed
await resp.close() Server will not know if it need to send close message back. So you need to send close first or it will wait for Also, remember to |
thanks! you saved me quite some time. 🙇 i copied the test from elsewhere and adapted it … poorly. i hope this is it then! |
Instead of while True: msg = await ws.receive() ... elif msg.tp == web.MsgType.close: break do: async for msg in ws: ...
|
||
items = ['q1', 'q2', 'q3'] | ||
for item in items: | ||
resp._writer.send(item) |
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.
Why do you need private attribute access. The test may use send()
and receive()
client response methods.
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.
eh, no idea, i copied stuff from elsewhere. what methods are you referring to?
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.
resp._writer.send(item)
?
I think he means _writer
is a private attribute and should not be used in testing.
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.
sure. my question is what i should use instead
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.
oh, sorry. i would have done it eventually 😅 |
Instead of
do: