Skip to content
Myr

test_timeouts.py

This file

Path

tests/test_timeouts.py

43 lines · 1.5 KiB · Python

Last changed by

Replace remaining occurrences of dispatch with transport (#1010)Josep Cugatbefore adoption89a8100

History of this file

Take it

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

Drop BackgroundManager in favor of fork(func1, func2) (#603)Florimond Mancabefore adoptionc38fd68

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

Drop BackgroundManager in favor of fork(func1, func2) (#603)Florimond Mancabefore adoptionc38fd68

lines 4–5why, one step back
4
5

Clean up 'backend' fixture (#664)Florimond Mancabefore adoptiond0427be

lines 6–7why, one step back
6@pytest.mark.usefixtures("async_environment")
7async def test_read_timeout(server):

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

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

Drop BackgroundManager in favor of fork(func1, func2) (#603)Florimond Mancabefore adoptionc38fd68

line 9why, one step back
9

Rename Client to AsyncClient (with compat synonym) (#680)Florimond Mancabefore adoptione284b84

line 10why, one step back
10 async with httpx.AsyncClient(timeout=timeout) as client:

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

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

Drop BackgroundManager in favor of fork(func1, func2) (#603)Florimond Mancabefore adoptionc38fd68

lines 12–14why, one step back
12 await client.get(server.url.copy_with(path="/slow_response"))
1314

Clean up 'backend' fixture (#664)Florimond Mancabefore adoptiond0427be

lines 15–16why, one step back
15@pytest.mark.usefixtures("async_environment")
16async def test_write_timeout(server):

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

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

Drop BackgroundManager in favor of fork(func1, func2) (#603)Florimond Mancabefore adoptionc38fd68

line 18why, one step back
18

Rename Client to AsyncClient (with compat synonym) (#680)Florimond Mancabefore adoptione284b84

line 19why, one step back
19 async with httpx.AsyncClient(timeout=timeout) as client:

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

line 20why, one step back
20 with pytest.raises(httpx.WriteTimeout):

Drop BackgroundManager in favor of fork(func1, func2) (#603)Florimond Mancabefore adoptionc38fd68

lines 21–24why, one step back
21 data = b"*" * 1024 * 1024 * 100
22 await client.put(server.url.copy_with(path="/slow_response"), data=data)2324

Clean up 'backend' fixture (#664)Florimond Mancabefore adoptiond0427be

lines 25–26why, one step back
25@pytest.mark.usefixtures("async_environment")
26async def test_connect_timeout(server):

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

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

Drop BackgroundManager in favor of fork(func1, func2) (#603)Florimond Mancabefore adoptionc38fd68

line 28why, one step back
28

Rename Client to AsyncClient (with compat synonym) (#680)Florimond Mancabefore adoptione284b84

line 29why, one step back
29 async with httpx.AsyncClient(timeout=timeout) as client:

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

line 30why, one step back
30 with pytest.raises(httpx.ConnectTimeout):

Drop BackgroundManager in favor of fork(func1, func2) (#603)Florimond Mancabefore adoptionc38fd68

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

Clean up 'backend' fixture (#664)Florimond Mancabefore adoptiond0427be

lines 35–36why, one step back
35@pytest.mark.usefixtures("async_environment")
36async def test_pool_timeout(server):

Replace remaining occurrences of dispatch with transport (#1010)Josep Cugatbefore adoption89a8100

line 37why, one step back
37 pool_limits = httpx.PoolLimits(max_connections=1)

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

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

Drop BackgroundManager in favor of fork(func1, func2) (#603)Florimond Mancabefore adoptionc38fd68

line 39why, one step back
39

Rename Client to AsyncClient (with compat synonym) (#680)Florimond Mancabefore adoptione284b84

line 40why, one step back
40 async with httpx.AsyncClient(pool_limits=pool_limits, timeout=timeout) as client:

Drop BackgroundManager in favor of fork(func1, func2) (#603)Florimond Mancabefore adoptionc38fd68

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

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

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

Drop BackgroundManager in favor of fork(func1, func2) (#603)Florimond Mancabefore adoptionc38fd68

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