Skip to content
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

Merged
merged 13 commits into from
Aug 25, 2016

Conversation

esaezgil
Copy link
Contributor

@esaezgil esaezgil commented Jul 29, 2016

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

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes

@coveralls
Copy link

coveralls commented Jul 29, 2016

Coverage Status

Coverage increased (+0.0006%) to 97.942% when pulling 8236bd9 on esaezgil:master into e2386a7 on KeepSafe:master.

@esaezgil esaezgil closed this Jul 29, 2016
@esaezgil esaezgil reopened this Jul 29, 2016
@esaezgil esaezgil closed this Jul 29, 2016
@coveralls
Copy link

coveralls commented Jul 29, 2016

Coverage Status

Coverage increased (+0.0006%) to 97.942% when pulling 8236bd9 on esaezgil:master into e2386a7 on KeepSafe:master.

@esaezgil esaezgil reopened this Jul 29, 2016
@coveralls
Copy link

coveralls commented Jul 29, 2016

Coverage Status

Coverage increased (+0.0006%) to 97.942% when pulling 8236bd9 on esaezgil:master into e2386a7 on KeepSafe:master.

@coveralls
Copy link

coveralls commented Jul 29, 2016

Coverage Status

Coverage decreased (-2.2%) to 95.701% when pulling 868457e on esaezgil:master into e2386a7 on KeepSafe:master.

@coveralls
Copy link

coveralls commented Jul 29, 2016

Coverage Status

Coverage increased (+0.0006%) to 97.942% when pulling 30d82f2 on esaezgil:master into e2386a7 on KeepSafe:master.

@esaezgil esaezgil closed this Jul 29, 2016
@esaezgil esaezgil reopened this Jul 29, 2016
@coveralls
Copy link

coveralls commented Jul 29, 2016

Coverage Status

Coverage increased (+0.0006%) to 97.942% when pulling 30d82f2 on esaezgil:master into e2386a7 on KeepSafe:master.

@coveralls
Copy link

coveralls commented Jul 29, 2016

Coverage Status

Coverage increased (+0.0006%) to 97.942% when pulling 9cceb5d on esaezgil:master into e2386a7 on KeepSafe:master.

@@ -206,6 +206,7 @@ def test_srv_keep_alive(srv):
assert not srv._keep_alive


@pytest.mark.timeout(0)
Copy link
Member

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?

Copy link
Contributor Author

@esaezgil esaezgil Jul 30, 2016

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

Copy link
Member

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

@asvetlov
Copy link
Member

  1. Implement __bool__ method.
  2. Write tests

@coveralls
Copy link

coveralls commented Jul 30, 2016

Coverage Status

Coverage increased (+0.0006%) to 97.928% when pulling 187c85a on esaezgil:master into 1a61823 on KeepSafe:master.

@@ -37,6 +38,8 @@ def __init__(self, *,
self._timeout = timeout
self._autoclose = autoclose
self._autoping = autoping
self._web_socket_ready = namedtuple('web_socket_ready',
Copy link
Member

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.

@coveralls
Copy link

coveralls commented Jul 30, 2016

Coverage Status

Coverage increased (+0.0006%) to 97.928% when pulling c154a76 on esaezgil:master into 1a61823 on KeepSafe:master.

@asvetlov
Copy link
Member

Much better but tests and __bool__ are still required.

@@ -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
Copy link
Member

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

Copy link
Member

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?

@codecov-io
Copy link

codecov-io commented Aug 11, 2016

Current coverage is 97.64% (diff: 100%)

Merging #1020 into master will increase coverage by <.01%

@@             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          

Powered by Codecov. Last update 3759c40...f1bcc8e

@asvetlov
Copy link
Member

Please add a test for __bool__.
I believe it is the last missing point.

@esaezgil
Copy link
Contributor Author

Hi Andrew, thanks for reviewing the PR. I updated it after your last comment. Please let me know if you have any other comments.
Enrique

@asvetlov asvetlov merged commit 568c074 into aio-libs:master Aug 25, 2016
@asvetlov
Copy link
Member

Thanks!

@lock
Copy link

lock bot commented Oct 29, 2019

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.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants