Skip to content
Myr

test_timeouts.py

This file

Path

tests/test_timeouts.py

49 lines · 1.4 KiB · Python

Last changed by

Add Client.stream() method. (#600)Tom Christiebefore adoption8d8ea8b

History of this file

Take it

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

Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6

lines 1–3why, one step back
1import pytest
23from httpx import (

Fix bug when using client without timeouts in Python 3.6 (#383)Florimond Mancabefore adoptioncadb9a4

line 4why, one step back
4 Client,

Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6

lines 5–8why, one step back
5 ConnectTimeout,
6 PoolLimits,7 PoolTimeout,8 ReadTimeout,

TimeoutConfig -> Timeout (#591)Tom Christiebefore adoptionc033ed1

line 9why, one step back
9 Timeout,

Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6

lines 10–13why, one step back
10 WriteTimeout,
11)1213

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

line 14why, one step back
14async def test_read_timeout(server, backend):

TimeoutConfig -> Timeout (#591)Tom Christiebefore adoptionc033ed1

line 15why, one step back
15 timeout = Timeout(read_timeout=1e-6)

Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6

line 16why, one step back
16

Drop sync (#544)Tom Christiebefore adoption206c537

line 17why, one step back
17 async with Client(timeout=timeout, backend=backend) as client:

Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6

line 18why, one step back
18 with pytest.raises(ReadTimeout):

Add server.url property in tests (#300)Bakhtiyor Ruzievbefore adoptione34d280

line 19why, one step back
19 await client.get(server.url.copy_with(path="/slow_response"))

Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6

lines 20–21why, one step back
20
21

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

line 22why, one step back
22async def test_write_timeout(server, backend):

TimeoutConfig -> Timeout (#591)Tom Christiebefore adoptionc033ed1

line 23why, one step back
23 timeout = Timeout(write_timeout=1e-6)

Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6

line 24why, one step back
24

Drop sync (#544)Tom Christiebefore adoption206c537

line 25why, one step back
25 async with Client(timeout=timeout, backend=backend) as client:

Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6

lines 26–27why, one step back
26 with pytest.raises(WriteTimeout):
27 data = b"*" * 1024 * 1024 * 100

Add server.url property in tests (#300)Bakhtiyor Ruzievbefore adoptione34d280

line 28why, one step back
28 await client.put(server.url.copy_with(path="/slow_response"), data=data)

Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6

lines 29–30why, one step back
29
30

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

line 31why, one step back
31async def test_connect_timeout(server, backend):

TimeoutConfig -> Timeout (#591)Tom Christiebefore adoptionc033ed1

line 32why, one step back
32 timeout = Timeout(connect_timeout=1e-6)

Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6

line 33why, one step back
33

Drop sync (#544)Tom Christiebefore adoption206c537

line 34why, one step back
34 async with Client(timeout=timeout, backend=backend) as client:

Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6

lines 35–39why, one step back
35 with pytest.raises(ConnectTimeout):
36 # See https://stackoverflow.com/questions/100841/37 await client.get("http://10.255.255.1/")3839

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

line 40why, one step back
40async def test_pool_timeout(server, backend):

Pool timeouts should be on the TimeoutConfig, not PoolLimits (#563)Tom Christiebefore adoption364378a

line 41why, one step back
41 pool_limits = PoolLimits(hard_limit=1)

TimeoutConfig -> Timeout (#591)Tom Christiebefore adoptionc033ed1

line 42why, one step back
42 timeout = Timeout(pool_timeout=1e-4)

Run SSLConfig cert loading in threadpool (#209)Can Sarıgölbefore adoptionc5248e6

line 43why, one step back
43

Pool timeouts should be on the TimeoutConfig, not PoolLimits (#563)Tom Christiebefore adoption364378a

lines 44–46why, one step back
44 async with Client(
45 pool_limits=pool_limits, timeout=timeout, backend=backend46 ) as client:

Add Client.stream() method. (#600)Tom Christiebefore adoption8d8ea8b

lines 47–49why, one step back
47 async with client.stream("GET", server.url):
48 with pytest.raises(PoolTimeout):49 await client.get("http://localhost:8000/")