Skip to content
Myr

test_timeouts.py

This file

Path

tests/test_timeouts.py

55 lines · 1.7 KiB · Python

Last changed by

Fix client.send() timeout new Request instance (#3116)Alexbefore adoption6d852d3

History of this file

Take it

The walk stopped after 200 commits: lines older than 5098f47 point at it.

Bump cryptography from 38.0.3 to 38.0.4 (#2485)dependabot[bot]before adoption5098f47

lines 1–5why, one step back
1import pytest
23import httpx45

replace pytest-asyncio and pytest-trio with anyio (#2512)Thomas Graingerbefore adoptione27d1b8

line 6why, one step back
6@pytest.mark.anyio

Bump cryptography from 38.0.3 to 38.0.4 (#2485)dependabot[bot]before adoption5098f47

lines 7–14why, one step back
7async def test_read_timeout(server):
8 timeout = httpx.Timeout(None, read=1e-6)910 async with httpx.AsyncClient(timeout=timeout) as client:11 with pytest.raises(httpx.ReadTimeout):12 await client.get(server.url.copy_with(path="/slow_response"))1314

replace pytest-asyncio and pytest-trio with anyio (#2512)Thomas Graingerbefore adoptione27d1b8

line 15why, one step back
15@pytest.mark.anyio

Bump cryptography from 38.0.3 to 38.0.4 (#2485)dependabot[bot]before adoption5098f47

lines 16–24why, one step back
16async def test_write_timeout(server):
17 timeout = httpx.Timeout(None, write=1e-6)1819 async with httpx.AsyncClient(timeout=timeout) as client:20 with pytest.raises(httpx.WriteTimeout):21 data = b"*" * 1024 * 1024 * 10022 await client.put(server.url.copy_with(path="/slow_response"), content=data)2324

replace pytest-asyncio and pytest-trio with anyio (#2512)Thomas Graingerbefore adoptione27d1b8

line 25why, one step back
25@pytest.mark.anyio

Bump cryptography from 38.0.3 to 38.0.4 (#2485)dependabot[bot]before adoption5098f47

lines 26–35why, one step back
26@pytest.mark.network
27async def test_connect_timeout(server):28 timeout = httpx.Timeout(None, connect=1e-6)2930 async with httpx.AsyncClient(timeout=timeout) as client:31 with pytest.raises(httpx.ConnectTimeout):32 # See https://stackoverflow.com/questions/100841/33 await client.get("http://10.255.255.1/")3435

replace pytest-asyncio and pytest-trio with anyio (#2512)Thomas Graingerbefore adoptione27d1b8

line 36why, one step back
36@pytest.mark.anyio

Bump cryptography from 38.0.3 to 38.0.4 (#2485)dependabot[bot]before adoption5098f47

lines 37–44why, one step back
37async def test_pool_timeout(server):
38 limits = httpx.Limits(max_connections=1)39 timeout = httpx.Timeout(None, pool=1e-4)4041 async with httpx.AsyncClient(limits=limits, timeout=timeout) as client:42 with pytest.raises(httpx.PoolTimeout):43 async with client.stream("GET", server.url):44 await client.get(server.url)

Fix client.send() timeout new Request instance (#3116)Alexbefore adoption6d852d3

lines 45–55why, one step back
45
4647@pytest.mark.anyio48async def test_async_client_new_request_send_timeout(server):49 timeout = httpx.Timeout(1e-6)5051 async with httpx.AsyncClient(timeout=timeout) as client:52 with pytest.raises(httpx.TimeoutException):53 await client.send(54 httpx.Request("GET", server.url.copy_with(path="/slow_response"))55 )