Skip to content

Conversation

@Kludex
Copy link
Owner

@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

@Kludex Kludex changed the title TestClient timeout simulates http.disconnect TestClient timeout simulates http.disconnect Jan 29, 2022
@lovelydinosaur
Copy link
Contributor

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
Owner 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.

@lovelydinosaur
Copy link
Contributor

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
Owner 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