test_timeouts.py
This file
Path
tests/test_timeouts.py
60 lines · 1.8 KiB · Python
Last changed by
Fix bug when using client without timeouts in Python 3.6 (#383)Florimond Mancabefore adoptioncadb9a4
History of this fileTake it
The walk stopped after 200 commits: lines older than 53a3e55 point at it.
Update README.mdTom Christiebefore adoption53a3e55
lines 1–2why, one step back1import pytest2Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 3why, one step back3from httpx import (Update README.mdTom Christiebefore adoption53a3e55
line 4why, one step back4 AsyncClient,Fix bug when using client without timeouts in Python 3.6 (#383)Florimond Mancabefore adoptioncadb9a4
line 5why, one step back5 Client,Update README.mdTom Christiebefore adoption53a3e55
lines 6–14why, one step back6 ConnectTimeout,7 PoolLimits,8 PoolTimeout,9 ReadTimeout,10 TimeoutConfig,11 WriteTimeout,12)1314Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 15–16why, one step back15async def test_read_timeout(server, backend):16 timeout = TimeoutConfig(read_timeout=1e-6)Update README.mdTom Christiebefore adoption53a3e55
line 17why, one step back17Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
line 18why, one step back18 async with AsyncClient(timeout=timeout, backend=backend) as client:Update README.mdTom Christiebefore adoption53a3e55
line 19why, one step back19 with pytest.raises(ReadTimeout):Add server.url property in tests (#300)Bakhtiyor Ruzievbefore adoptione34d280
line 20why, one step back20 await client.get(server.url.copy_with(path="/slow_response"))Update README.mdTom Christiebefore adoption53a3e55
lines 21–22why, one step back2122Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 23–24why, one step back23async def test_write_timeout(server, backend):24 timeout = TimeoutConfig(write_timeout=1e-6)Update README.mdTom Christiebefore adoption53a3e55
line 25why, one step back25Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
line 26why, one step back26 async with AsyncClient(timeout=timeout, backend=backend) as client:Update README.mdTom Christiebefore adoption53a3e55
lines 27–28why, one step back27 with pytest.raises(WriteTimeout):28 data = b"*" * 1024 * 1024 * 100Add server.url property in tests (#300)Bakhtiyor Ruzievbefore adoptione34d280
line 29why, one step back29 await client.put(server.url.copy_with(path="/slow_response"), data=data)Update README.mdTom Christiebefore adoption53a3e55
lines 30–31why, one step back3031Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 32–33why, one step back32async def test_connect_timeout(server, backend):33 timeout = TimeoutConfig(connect_timeout=1e-6)Update README.mdTom Christiebefore adoption53a3e55
line 34why, one step back34Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
line 35why, one step back35 async with AsyncClient(timeout=timeout, backend=backend) as client:Update README.mdTom Christiebefore adoption53a3e55
lines 36–40why, one step back36 with pytest.raises(ConnectTimeout):37 # See https://stackoverflow.com/questions/100841/38 await client.get("http://10.255.255.1/")3940Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
line 41why, one step back41async def test_pool_timeout(server, backend):Add trio concurrency backend (#276)Florimond Mancabefore adoption08355c6
line 42why, one step back42 pool_limits = PoolLimits(hard_limit=1, pool_timeout=1e-4)Update README.mdTom Christiebefore adoption53a3e55
line 43why, one step back43Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
line 44why, one step back44 async with AsyncClient(pool_limits=pool_limits, backend=backend) as client:Add server.url property in tests (#300)Bakhtiyor Ruzievbefore adoptione34d280
line 45why, one step back45 response = await client.get(server.url, stream=True)Update README.mdTom Christiebefore adoption53a3e55
lines 46–50why, one step back4647 with pytest.raises(PoolTimeout):48 await client.get("http://localhost:8000/")4950 await response.read()Fix bug when using client without timeouts in Python 3.6 (#383)Florimond Mancabefore adoptioncadb9a4
lines 51–60why, one step back515253def test_sync_infinite_timeout(server):54 """Regression test for a bug that occurred under Python 3.6.5556 See: https://github.com/encode/httpx/issues/38257 """58 no_timeout = TimeoutConfig()59 with Client(timeout=no_timeout) as client:60 client.get(server.url.copy_with(path="/slow_response/50"))