Skip to content
Myr

test_timeouts.py

This file

Path

tests/test_timeouts.py

43 lines · 1.5 KiB · Python

Last changed by

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

History of this file

Take it

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

Set Host header when redirecting cross-origin (#321)Gaurav Dhameejabefore adoption3065dd6

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

Set Host header when redirecting cross-origin (#321)Gaurav Dhameejabefore adoption3065dd6

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)

Set Host header when redirecting cross-origin (#321)Gaurav Dhameejabefore adoption3065dd6

line 9why, one step back
9

Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d

line 10why, one step back
10 async with httpx.Client(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):

Set Host header when redirecting cross-origin (#321)Gaurav Dhameejabefore adoption3065dd6

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)

Set Host header when redirecting cross-origin (#321)Gaurav Dhameejabefore adoption3065dd6

line 18why, one step back
18

Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d

line 19why, one step back
19 async with httpx.Client(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):

Set Host header when redirecting cross-origin (#321)Gaurav Dhameejabefore adoption3065dd6

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)

Set Host header when redirecting cross-origin (#321)Gaurav Dhameejabefore adoption3065dd6

line 28why, one step back
28

Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d

line 29why, one step back
29 async with httpx.Client(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):

Set Host header when redirecting cross-origin (#321)Gaurav Dhameejabefore adoption3065dd6

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):

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

lines 37–38why, one step back
37 pool_limits = httpx.PoolLimits(hard_limit=1)
38 timeout = httpx.Timeout(pool_timeout=1e-4)

Set Host header when redirecting cross-origin (#321)Gaurav Dhameejabefore adoption3065dd6

line 39why, one step back
39

Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d

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

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

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):

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

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