From: Tom Christie Date: Thu, 18 Apr 2019 08:38:29 +0000 (+0100) Subject: Add ConnectTimeout test X-Git-Tag: 0.1.0~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74c9048ba247d1ce5da809ee5a01e2429aa95791;p=thirdparty%2Fhttpx.git Add ConnectTimeout test --- diff --git a/tests/test_timeouts.py b/tests/test_timeouts.py index 61ce9a18..b1ceef93 100644 --- a/tests/test_timeouts.py +++ b/tests/test_timeouts.py @@ -12,6 +12,16 @@ async def test_read_timeout(server): await http.request("GET", "http://127.0.0.1:8000/slow_response") +@pytest.mark.asyncio +async def test_connect_timeout(server): + timeout = httpcore.TimeoutConfig(connect_timeout=0.0001) + + async with httpcore.ConnectionPool(timeout=timeout) as http: + with pytest.raises(httpcore.ConnectTimeout): + # See https://stackoverflow.com/questions/100841/ + await http.request("GET", "http://10.255.255.1/") + + @pytest.mark.asyncio async def test_pool_timeout(server): timeout = httpcore.TimeoutConfig(pool_timeout=0.0001)