test_timeouts.py
This file
Path
tests/test_timeouts.py
39 lines · 1.3 KiB · Python
Last changed by
Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d
History of this fileTake it
The walk stopped after 200 commits: lines older than 994403b point at it.
Serve test server in thread (#292)Florimond Mancabefore adoption994403b
lines 1–2why, one step back1import pytest2Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b
line 3why, one step back3import httpxServe test server in thread (#292)Florimond Mancabefore adoption994403b
lines 4–6why, one step back456async def test_read_timeout(server, backend):Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b
line 7why, one step back7 timeout = httpx.Timeout(read_timeout=1e-6)Serve test server in thread (#292)Florimond Mancabefore adoption994403b
line 8why, one step back8Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d
line 9why, one step back9 async with httpx.Client(timeout=timeout) as client:Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b
line 10why, one step back10 with pytest.raises(httpx.ReadTimeout):Add server.url property in tests (#300)Bakhtiyor Ruzievbefore adoptione34d280
line 11why, one step back11 await client.get(server.url.copy_with(path="/slow_response"))Serve test server in thread (#292)Florimond Mancabefore adoption994403b
lines 12–14why, one step back121314async def test_write_timeout(server, backend):Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b
line 15why, one step back15 timeout = httpx.Timeout(write_timeout=1e-6)Serve test server in thread (#292)Florimond Mancabefore adoption994403b
line 16why, one step back16Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d
line 17why, one step back17 async with httpx.Client(timeout=timeout) as client:Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b
line 18why, one step back18 with pytest.raises(httpx.WriteTimeout):Serve test server in thread (#292)Florimond Mancabefore adoption994403b
line 19why, one step back19 data = b"*" * 1024 * 1024 * 100Add server.url property in tests (#300)Bakhtiyor Ruzievbefore adoptione34d280
line 20why, one step back20 await client.put(server.url.copy_with(path="/slow_response"), data=data)Serve test server in thread (#292)Florimond Mancabefore adoption994403b
lines 21–23why, one step back212223async def test_connect_timeout(server, backend):Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b
line 24why, one step back24 timeout = httpx.Timeout(connect_timeout=1e-6)Serve test server in thread (#292)Florimond Mancabefore adoption994403b
line 25why, one step back25Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d
line 26why, one step back26 async with httpx.Client(timeout=timeout) as client:Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b
line 27why, one step back27 with pytest.raises(httpx.ConnectTimeout):Serve test server in thread (#292)Florimond Mancabefore adoption994403b
lines 28–32why, one step back28 # See https://stackoverflow.com/questions/100841/29 await client.get("http://10.255.255.1/")303132async def test_pool_timeout(server, backend):Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b
lines 33–34why, one step back33 pool_limits = httpx.PoolLimits(hard_limit=1)34 timeout = httpx.Timeout(pool_timeout=1e-4)Serve test server in thread (#292)Florimond Mancabefore adoption994403b
line 35why, one step back35Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d
line 36why, one step back36 async with httpx.Client(pool_limits=pool_limits, timeout=timeout) as client:Add Client.stream() method. (#600)Tom Christiebefore adoption8d8ea8b
line 37why, one step back37 async with client.stream("GET", server.url):Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b
line 38why, one step back38 with pytest.raises(httpx.PoolTimeout):Add Client.stream() method. (#600)Tom Christiebefore adoption8d8ea8b
line 39why, one step back39 await client.get("http://localhost:8000/")