Conversation
| @@ -8,10 +8,11 @@ | |||
| import httpx | |||
There was a problem hiding this comment.
Can we remove httpx from here?
There was a problem hiding this comment.
Maybe at some point, but I don't think we are there yet. We really need a new way to test timeouts. I think I have an idea, but there are higher priorities that are on my list to accomplish before the next release.
With that said, if anyone wants to take on these tests, I would be happy to help.
There was a problem hiding this comment.
I don't see a problem in using third-party requirements on our testing, since they are actually required in our own testing package, unless we remove httpx from sanic_testing in the future.
There was a problem hiding this comment.
I meant that I really don't like the tests themselves that require us to hack httpx here. I have no intention of removing httpx from the testing client because the ASGI reach in is awesome.
|
Yes. There are two tests that are failing and I'm not really sure why. The clients are nearly identical. It seems when we do a websocket call on the test_client, the server doesn't completely shutdown. I'm trying to see if it is a problem with the test, the client, or the websockets implementation. 🤔 I created a third client in my local reo that opens the server in a subprocess instead of using listeners. I can get the test passing with that. |
Codecov Report
@@ Coverage Diff @@
## master #2009 +/- ##
==========================================
- Coverage 91.52% 91.48% -0.05%
==========================================
Files 29 28 -1
Lines 3341 3182 -159
Branches 585 573 -12
==========================================
- Hits 3058 2911 -147
+ Misses 201 192 -9
+ Partials 82 79 -3
Continue to review full report at Codecov.
|
ashleysommer
left a comment
There was a problem hiding this comment.
I'm happy for this to be merged.
| return SanicTestClient(self) | ||
| if self._test_client: | ||
| return self._test_client | ||
| from sanic_testing.testing import SanicTestClient # type: ignore |
There was a problem hiding this comment.
| from sanic_testing.testing import SanicTestClient # type: ignore | |
| elif hasattr(self, "_test_manager"): | |
| return self._test_manager.test_client # type: ignore | |
| from sanic_testing.testing import SanicTestClient # type: ignore |
There was a problem hiding this comment.
Let's add that in another PR. I want to get this one merged.
| return SanicASGITestClient(self) | ||
| if self._asgi_client: | ||
| return self._asgi_client | ||
| from sanic_testing.testing import SanicASGITestClient # type: ignore |
There was a problem hiding this comment.
| from sanic_testing.testing import SanicASGITestClient # type: ignore | |
| elif hasattr(self, "_test_manager"): | |
| return self._test_manager.asgi_client # type: ignore | |
| from sanic_testing.testing import SanicASGITestClient # type: ignore |
This is a more recent implementation of #1850. This is to take out the testing module (and httpx dependency) in favor of
sanic-testing.Still some broken tests to fix.