Skip to content
Myr

Add test for write timeout error (#67)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Add test for write timeout error * Bump up write data 10x

authored by Yeray Diaz Diaz · committed by Tom Christie · parent 3ed0885 · Browse files · 2 files+12 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+12 added−0 removed

  • tests:+11 added−0 removed
  • other:+1 added−0 removed

2 files+12 added−0 removed

modified:httpcore/__init__.py+1 added
8 unmodified lines
9 InvalidURL,10 PoolTimeout,11 ProtocolError,12 ReadTimeout,13 WriteTimeout,14 RedirectBodyUnavailable,15 RedirectLoop,16 ResponseClosed,17 ResponseNotRead,
9 unmodified lines
modified:tests/test_timeouts.py+11 added
4 unmodified lines
5 ConnectTimeout,6 PoolLimits,7 PoolTimeout,8 ReadTimeout,9 WriteTimeout,10 TimeoutConfig,11)1213
6 unmodified lines
20 await client.get("http://127.0.0.1:8000/slow_response")212223@pytest.mark.asyncio24async def test_write_timeout(server):25 timeout = TimeoutConfig(write_timeout=0.0001)2627 async with AsyncClient(timeout=timeout) as client:28 with pytest.raises(WriteTimeout):29 data = b"*" * 1024 * 1024 * 1030 await client.put("http://127.0.0.1:8000/slow_response", data=data)313233@pytest.mark.asyncio34async def test_connect_timeout(server):35 timeout = TimeoutConfig(connect_timeout=0.0001)3637 async with AsyncClient(timeout=timeout) as client:
16 unmodified lines