starlette icon indicating copy to clipboard operation
starlette copied to clipboard

TestClient handle exceptions thrown from lifespan before shutdown event

Open graingert opened this issue 4 years ago • 3 comments

graingert avatar Jul 03 '21 21:07 graingert

Could you please edit the title/description to specify that this only affects TestClient? A bit more context in the description as to what you're trying to achieve would help as well.

uSpike avatar Jul 04 '21 14:07 uSpike

Could you please edit the title/description to specify that this only affects TestClient? A bit more context in the description as to what you're trying to achieve would help as well.

I'm trying to make it so that if an exception is thrown into a taskgroup spanning the lifespan_context the exception is thrown out of the TestClient context as quickly as possible.

It does this by cancelling any concurrent requests of the TestClient and preventing any new requests until the TestClient is closed

graingert avatar Jul 04 '21 14:07 graingert

@graingert Are you still interested in this, or can I close it?

We still don't know what we are going to do with the TestClient on Starlette (if it's going to be deprecated/removed or switch to httpx).

Kludex avatar Jun 11 '22 06:06 Kludex

@graingert Closing this as stale.

You're a member, so if you think we should reopen, go ahead. 😗

Kludex avatar Aug 12 '22 17:08 Kludex

Oh yeah this needs doing lol

graingert avatar Aug 12 '22 17:08 graingert

Wait no. Doing everything via httpx is obviously better

graingert avatar Aug 12 '22 17:08 graingert