test_timeouts.py
This file
Path
tests/test_timeouts.py
49 lines · 1.5 KiB · Python
Last changed by
Add trio concurrency backend (#276)Florimond Mancabefore adoption08355c6
History of this fileTake it
The walk stopped after 200 commits: lines older than 8c43fca point at it.
Drop unreachable except block (#69)Tom Christiebefore adoption8c43fca
lines 1–2why, one step back1import pytest2Renaming -> httpx (#129)Tom Christiebefore adoption2d09d5b
line 3why, one step back3from httpx import (Drop unreachable except block (#69)Tom Christiebefore adoption8c43fca
lines 4–9why, one step back4 AsyncClient,5 ConnectTimeout,6 PoolLimits,7 PoolTimeout,8 ReadTimeout,9 TimeoutConfig,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 10why, one step back10 WriteTimeout,Drop unreachable except block (#69)Tom Christiebefore adoption8c43fca
lines 11–13why, one step back11)1213Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 14–15why, one step back14async def test_read_timeout(server, backend):15 timeout = TimeoutConfig(read_timeout=1e-6)Drop unreachable except block (#69)Tom Christiebefore adoption8c43fca
line 16why, one step back16Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
line 17why, one step back17 async with AsyncClient(timeout=timeout, backend=backend) as client:Drop unreachable except block (#69)Tom Christiebefore adoption8c43fca
line 18why, one step back18 with pytest.raises(ReadTimeout):Add server.url property in tests (#300)Bakhtiyor Ruzievbefore adoptione34d280
line 19why, one step back19 await client.get(server.url.copy_with(path="/slow_response"))Add test for write timeout error (#67)Yeray Diaz Diazbefore adoptionb8b3714
lines 20–21why, one step back2021Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 22–23why, one step back22async def test_write_timeout(server, backend):23 timeout = TimeoutConfig(write_timeout=1e-6)Add test for write timeout error (#67)Yeray Diaz Diazbefore adoptionb8b3714
line 24why, one step back24Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
line 25why, one step back25 async with AsyncClient(timeout=timeout, backend=backend) as client:Add test for write timeout error (#67)Yeray Diaz Diazbefore adoptionb8b3714
line 26why, one step back26 with pytest.raises(WriteTimeout):100% test coverage (#71)Tom Christiebefore adoptionfc16d31
line 27why, one step back27 data = b"*" * 1024 * 1024 * 100Add server.url property in tests (#300)Bakhtiyor Ruzievbefore adoptione34d280
line 28why, one step back28 await client.put(server.url.copy_with(path="/slow_response"), data=data)Drop unreachable except block (#69)Tom Christiebefore adoption8c43fca
lines 29–30why, one step back2930Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
lines 31–32why, one step back31async def test_connect_timeout(server, backend):32 timeout = TimeoutConfig(connect_timeout=1e-6)Drop unreachable except block (#69)Tom Christiebefore adoption8c43fca
line 33why, one step back33Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
line 34why, one step back34 async with AsyncClient(timeout=timeout, backend=backend) as client:Drop unreachable except block (#69)Tom Christiebefore adoption8c43fca
lines 35–39why, one step back35 with pytest.raises(ConnectTimeout):36 # See https://stackoverflow.com/questions/100841/37 await client.get("http://10.255.255.1/")3839Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
line 40why, one step back40async def test_pool_timeout(server, backend):Add trio concurrency backend (#276)Florimond Mancabefore adoption08355c6
line 41why, one step back41 pool_limits = PoolLimits(hard_limit=1, pool_timeout=1e-4)Drop unreachable except block (#69)Tom Christiebefore adoption8c43fca
line 42why, one step back42Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058
line 43why, one step back43 async with AsyncClient(pool_limits=pool_limits, backend=backend) as client:Add server.url property in tests (#300)Bakhtiyor Ruzievbefore adoptione34d280
line 44why, one step back44 response = await client.get(server.url, stream=True)Drop unreachable except block (#69)Tom Christiebefore adoption8c43fca
lines 45–49why, one step back4546 with pytest.raises(PoolTimeout):47 await client.get("http://localhost:8000/")4849 await response.read()