Closed Tomas2D closed 11 months ago
Hello,
Thanks for reporting, if you mind pointing me to the source code of this transport I could check if there was a way to achieve this. In any case that is indeed a limitation of the current mock and I will not be able to have a look at it before a few weeks unfortunately.
Best Regards
Here it is: https://github.com/Tomas2D/httpx-pytest-transport-bug/blob/main/http_utils.py
The repo is really small; only the necessary parts are in it. Just a few files.
Basically, the handle_async_request
in my transport is not called, but it should be.
Mocking the handle_async_request instead of the class should do the trick indeed. If you don't mind waiting I should be able to work on this in a few weeks :)
Not sure about that. The library does not use the actual transport's handle_async_request
. It will be more complex. I am looking forward to your approach.
Any update? :)
Not sure about that. The library does not use the actual transport's
handle_async_request
. It will be more complex. I am looking forward to your approach.
The linked sample you provided is using handle_async_request and this is indeed an issue. If the fix (version 0.27.0) is not appropriate for your use case, feel free to open another issue with more details on the custom transport (how the actual http call is done)
From quick testing in the provided repository, it works as expected after the update. I will let you know if I encounter a problem with our more extensive project. Thank you, I appreciate your work.
Hello 👋🏻 Thanks for this great library!
I've recently found an issue where I found the Async Client's Transport is not used in tests. However, it should be.
Example of using custom transport:
When I send a request which fails, then it's automatically repeated. This does not happen during testing.
Example Repository: https://github.com/Tomas2D/httpx-pytest-transport-bug