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

TestClient timeout simulates http.disconnect #1446

Closed
wants to merge 2 commits into from

Conversation

Kludex
Copy link
Member

@Kludex Kludex commented Jan 29, 2022

There's an alternative timeout meaning on #1109, but I think we should proceed with this idea, as I can already see three usages:

Missing:

  • docs
  • Replace requests timeout exception by starlette native one

Co-authored-by: Fantix King <fantix@uchicago.edu>
@Kludex Kludex changed the title TestClient timeout simulates http.disconnect TestClient timeout simulates http.disconnect Jan 29, 2022
@tomchristie
Copy link
Member

My honest opinion on this is that we pretty much shouldn't be changing TestClient at all, until #1376 is in.

(I'm also not convinced by supporting timeout on the TestClient. It's okay for these things to have some constraints. It's not something that eg. Django's TestClient has, it's not something that the httpx.WSGITransport or httpx.ASGITransport cases support, and I'd be absolutely okay with Starlette not supporting it directly either.)

@Kludex
Copy link
Member Author

Kludex commented Feb 1, 2022

Would you have a recommendation on how to test the tests mentioned on the description? i.e. when we have an http.disconnect on the application.

@tomchristie
Copy link
Member

For now, I'd just suggest "The TestClient doesn't support timeouts. If you need to test this kind of behaviour you'll need to do so using ASGI messaging directly".

@Kludex Kludex closed this Feb 1, 2022
@Kludex
Copy link
Member Author

Kludex commented Feb 1, 2022

Thanks

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.

Disconnect event not received when using TestClient
3 participants