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
Although we have test coverage for our network backends, we're not currently testing against them directly.
Since #699 added the network backends to the public API we should also implement some tests against them.
There's three classes of test case that we'd want covered here...
Tests for the backends, without TLS.
Tests for the backends, with TLS.
Tests for the backends, with TLS-in-TLS.
I'd suggest that we start just by implementing some test cases for the first of those, with tests for each of...
httpcore.SyncBackend
httpcore.AnyIOBackend
httpcore.TrioBackend
So, just testing connecting, reading, writing.
Punching this one directly into an issue, since I think it's clear enough to not require a discussion phase.
But it'll be too complicated because we'll need different interfaces for the socket and trio/anyio bytestreams, as well as different factories for these streams, so I think it'd be better to just test with real connections.
I don't think we've sufficient motivation to treat this as a hard issue right now. This is maybe worth us covering, but I'm going to bump it down to a discussion. If it's valuable we ought to have a "what is this resolving for us, and is it worth the cost it brings".
Activity
karpetrosyan commentedon Jun 16, 2023
Should we use real connections or mock the underlying socket?
lovelydinosaur commentedon Jun 16, 2023
No sure. I'd assumed that we'd need to work with real sockets for these tests, I don't think we can mock it out without monkey-patching right?
karpetrosyan commentedon Jun 16, 2023
That's a little complicated, but it solves a lot of problems.
This is very similar to the "network_backend" argument.
karpetrosyan commentedon Jun 16, 2023
But it'll be too complicated because we'll need different interfaces for the socket and trio/anyio bytestreams, as well as different factories for these streams, so I think it'd be better to just test with real connections.
lovelydinosaur commentedon Sep 1, 2023
I don't think we've sufficient motivation to treat this as a hard issue right now. This is maybe worth us covering, but I'm going to bump it down to a discussion. If it's valuable we ought to have a "what is this resolving for us, and is it worth the cost it brings".