-
-
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
Return named_tuple from WebSocketResponse.can_prepare #1020
Conversation
@@ -206,6 +206,7 @@ def test_srv_keep_alive(srv): | |||
assert not srv._keep_alive | |||
|
|||
|
|||
@pytest.mark.timeout(0) |
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 did you modify non-related 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.
This test timed out, (I guess because of the addition of pytest-timeout) and modified it to fix it
My bad
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.
As I see tests are passed both locally and on travis-ci.
If timeout is an issue it should be fixed by separate PR anyway
|
@@ -37,6 +38,8 @@ def __init__(self, *, | |||
self._timeout = timeout | |||
self._autoclose = autoclose | |||
self._autoping = autoping | |||
self._web_socket_ready = namedtuple('web_socket_ready', |
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.
Sorry, you did't get my point.
Push
WebSocketReady = namedtuple(
WebSocketReady', ...)` at module namespace.
Much better but tests and |
@@ -178,25 +178,29 @@ def test_write_non_prepared(): | |||
def test_can_prepare_ok(make_request): | |||
req = make_request('GET', '/', protocols=True) | |||
ws = WebSocketResponse(protocols=('chat',)) | |||
assert bool(ws.can_prepare(request=req)) is True |
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.
Don't change existing tests but create a new one.
You don't need to call .can_prepare()
-- just create an instance of WebSocketReady
and test it.
I expect about three or four new tests
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.
Did you write unittests before?
Current coverage is 97.64% (diff: 100%)@@ master #1020 diff @@
==========================================
Files 28 28
Lines 6397 6401 +4
Methods 0 0
Messages 0 0
Branches 1085 1085
==========================================
+ Hits 6246 6250 +4
Misses 79 79
Partials 72 72
|
Please add a test for |
Hi Andrew, thanks for reviewing the PR. I updated it after your last comment. Please let me know if you have any other comments. |
Thanks! |
What do these changes do?
Return named tuple from WebSocketResponse.can_prepare
Are there changes in behavior for the user?
No
Related issue number
#1016
Checklist