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

Get to 100% coverage on everything except compat and utf8validator #30

Merged
merged 17 commits into from
Jun 9, 2017

Conversation

jeamland
Copy link
Collaborator

@jeamland jeamland commented Jun 2, 2017

Addresses #26

@codecov-io
Copy link

codecov-io commented Jun 2, 2017

Codecov Report

Merging #30 into master will increase coverage by 11.31%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #30       +/-   ##
==========================================
+ Coverage   87.98%   99.3%   +11.31%     
==========================================
  Files           7       7               
  Lines         849     860       +11     
  Branches      184     184               
==========================================
+ Hits          747     854      +107     
+ Misses         68       6       -62     
+ Partials       34       0       -34
Impacted Files Coverage Δ
wsproto/frame_protocol.py 100% <100%> (ø) ⬆️
wsproto/extensions.py 100% <100%> (+23.78%) ⬆️
wsproto/connection.py 100% <100%> (+21.86%) ⬆️
wsproto/events.py 100% <0%> (+25.64%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b7121f1...3e93344. Read the comment docs.

Copy link
Member

@njsmith njsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks awesome to me. A few questions below.

This actually gets to 100% coverage on everything except Utf8Validator (thanks to codecov aggregating across the different CI builds), and the only uncovered code in Utf8Validator is the decode method that we don't use. Do you want to go ahead and delete decode too, and then this PR would close #26?

if event is h11.NEED_DATA:
break
elif self.client and isinstance(event, h11.InformationalResponse):
elif self.client and isinstance(event, (h11.InformationalResponse,
h11.Response)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reasoning behind treating InformationalResponse and Response the same here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we can deal with HTTP responses that we don't like more effectively.

from wsproto.frame_protocol import CloseReason, FrameProtocol


class FakeProtocol(object):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting... in h11 I wrote these kinds of tests by having a bit of utility code to glue together two connection objects and do the initial setup, and then I would like, inject weird data or make assertions about the data on the wire. (Utility code, example test)

This potentially has some advantages, since it makes fewer assumptions about the internals of the connection object, and thus hopefully survives better as the code evolves. Not every test can be written this way, but it might be a useful tool to have around.

I'm not suggesting you need to rewrite all these or anything like that, just bringing it up as something for us to think about :-)

@jeamland jeamland merged commit 7123835 into python-hyper:master Jun 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants