Skip to content
Myr

test_timeouts.py

This file

Path

tests/test_timeouts.py

41 lines · 1.4 KiB · Python

Last changed by

Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b

History of this file

Take it

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

Release semaphore if connection is dropped (#230)Ordanis Sanchezbefore adoptiona960a2a

lines 1–2why, one step back
1import pytest
2

Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b

line 3why, one step back
3import httpx

Release semaphore if connection is dropped (#230)Ordanis Sanchezbefore adoptiona960a2a

lines 4–5why, one step back
4
5

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

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

Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b

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

Release semaphore if connection is dropped (#230)Ordanis Sanchezbefore adoptiona960a2a

line 8why, one step back
8

Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b

lines 9–10why, one step back
9 async with httpx.Client(timeout=timeout, backend=backend) as client:
10 with pytest.raises(httpx.ReadTimeout):

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

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

Release semaphore if connection is dropped (#230)Ordanis Sanchezbefore adoptiona960a2a

lines 12–13why, one step back
12
13

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

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

Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b

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

Release semaphore if connection is dropped (#230)Ordanis Sanchezbefore adoptiona960a2a

line 16why, one step back
16

Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b

lines 17–18why, one step back
17 async with httpx.Client(timeout=timeout, backend=backend) as client:
18 with pytest.raises(httpx.WriteTimeout):

Release semaphore if connection is dropped (#230)Ordanis Sanchezbefore adoptiona960a2a

line 19why, one step back
19 data = b"*" * 1024 * 1024 * 100

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

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

Release semaphore if connection is dropped (#230)Ordanis Sanchezbefore adoptiona960a2a

lines 21–22why, one step back
21
22

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

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

Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b

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

Release semaphore if connection is dropped (#230)Ordanis Sanchezbefore adoptiona960a2a

line 25why, one step back
25

Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b

lines 26–27why, one step back
26 async with httpx.Client(timeout=timeout, backend=backend) as client:
27 with pytest.raises(httpx.ConnectTimeout):

Release semaphore if connection is dropped (#230)Ordanis Sanchezbefore adoptiona960a2a

lines 28–31why, one step back
28 # See https://stackoverflow.com/questions/100841/
29 await client.get("http://10.255.255.1/")3031

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

line 32why, one step back
32async 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 back
33 pool_limits = httpx.PoolLimits(hard_limit=1)
34 timeout = httpx.Timeout(pool_timeout=1e-4)

Release semaphore if connection is dropped (#230)Ordanis Sanchezbefore adoptiona960a2a

line 35why, one step back
35

Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b

line 36why, one step back
36 async with httpx.Client(

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

lines 37–38why, one step back
37 pool_limits=pool_limits, timeout=timeout, backend=backend
38 ) as client:

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

line 39why, one step back
39 async with client.stream("GET", server.url):

Tighten up top-level API to only expose public API (#608)Tom Christiebefore adoptiond15dc0b

line 40why, one step back
40 with pytest.raises(httpx.PoolTimeout):

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

line 41why, one step back
41 await client.get("http://localhost:8000/")