You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Line 69 covers receiving an informational response which I haven't been able to reproduce from our server fixture.
Lines 100-103: Close with H11 protocol error, I've tried manually reproducing an error but it would require reaching into the connection pool and manually closing the connection simply to trigger a pass, I'd say it's a candidate for pragma: nocover
httpcore/concurrency.py 90 3 97% 79, 93-94
Line 79: Covers the Writer.write_no_block method, which I'm not sure what it does or how to reproduce it.
Lines 93-94: Handles an exception on stream_writer.drain to raise a WriteTimeout, I don't know how to recreate its conditions in a test.
Lines 78-80: are the body of ConnectionStore.__getitem__ which I'm not clear on what it does as it seems to return the key if it's in the store or None otherwise, which seems like a membership test?
Stonkin great work here!
Sending an Expect : 100-continue header ought to trigger Uvicorn to issue a 100 informational response. That’d knock off one more!
I think closing a steaming response without reading it should trigger the h11 protocol error case, but I’m not 100% without reviewing it more thoroughly.
@yeraydiazdiaz Final remaining line here is in write_no_block. We use that interface in the HTTP/2 case in order to strictly write the HTTP/2 connection initialization, without allowing for any race conditions of "we've hit an async/await, so the task switched out under us, and wrote some different data first".
Because uvicorn doesn't currently have HTTP/2 support we're only ever testing out against a mock HTTP/2 server implementation, and we're never hitting that line.
I'm just going to pragma: nocover it for now as unreachable in test.
Activity
yeraydiazdiaz commentedon May 14, 2019
The merged PRs and #64 is as much as I've been able to increase the coverage, the report on that branch is as follows:
httpcore/dispatch/http11.py 73 3 96% 69, 100-103pass, I'd say it's a candidate forpragma: nocoverhttpcore/concurrency.py 90 3 97% 79, 93-94Writer.write_no_blockmethod, which I'm not sure what it does or how to reproduce it.stream_writer.drainto raise a WriteTimeout, I don't know how to recreate its conditions in a test.httpcore/dispatch/connection_pool.py 96 3 97% 78-80ConnectionStore.__getitem__which I'm not clear on what it does as it seems to return the key if it's in the store or None otherwise, which seems like a membership test?Any pointers?
lovelydinosaur commentedon May 14, 2019
Stonkin great work here!
Sending an
Expect : 100-continueheader ought to trigger Uvicorn to issue a 100 informational response. That’d knock off one more!lovelydinosaur commentedon May 14, 2019
I think closing a steaming response without reading it should trigger the h11 protocol error case, but I’m not 100% without reviewing it more thoroughly.
lovelydinosaur commentedon May 14, 2019
For the WriteTimeout, try sending a large request in
test_timeouts.py, to the slow_response endpoint, using a tiny write timeout.yeraydiazdiaz commentedon May 15, 2019
Awesome, thanks for the tips! I'll try those out (in separate PRs) today 👍
lovelydinosaur commentedon May 15, 2019
Rad.
lovelydinosaur commentedon May 16, 2019
@yeraydiazdiaz Final remaining line here is in
write_no_block. We use that interface in the HTTP/2 case in order to strictly write the HTTP/2 connection initialization, without allowing for any race conditions of "we've hit an async/await, so the task switched out under us, and wrote some different data first".Because uvicorn doesn't currently have HTTP/2 support we're only ever testing out against a mock HTTP/2 server implementation, and we're never hitting that line.
I'm just going to
pragma: nocoverit for now as unreachable in test.lovelydinosaur commentedon May 16, 2019
Thanks so much for your help on this!
yeraydiazdiaz commentedon May 16, 2019
No worries, glad we could get it done 🎉
lovelydinosaur commentedon May 16, 2019
🤩