test_write_timeout fails on my environmentWriteTimeout ExceptionWindows 10 Pro 1809 (Build 17763.615)
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32
Package Version
--------------------- ---------
appdirs 1.4.3
asn1crypto 0.24.0
atomicwrites 1.3.0
attrs 19.1.0
autoflake 1.3
black 19.3b0
brotlipy 0.7.0
certifi 2019.6.16
cffi 1.12.3
chardet 3.0.4
Click 7.0
colorama 0.4.1
coverage 4.5.4
cryptography 2.7
entrypoints 0.3
flake8 3.7.8
flake8-bugbear 19.3.0
flake8-comprehensions 2.1.0
h11 0.8.1
h2 3.1.1
hpack 3.0.0
hstspreload 2019.7.31
htmlmin 0.1.12
hyperframe 5.2.0
idna 2.8
importlib-metadata 0.19
isort 4.3.21
Jinja2 2.10.1
jsmin 2.2.2
livereload 2.6.1
Markdown 3.1.1
MarkupSafe 1.1.1
mccabe 0.6.1
mkdocs 1.0.4
mkdocs-material 4.4.0
mkdocs-minify-plugin 0.2.1
more-itertools 7.2.0
mypy 0.720
mypy-extensions 0.4.1
packaging 19.1
pip 19.0.3
pluggy 0.12.0
py 1.8.0
pycodestyle 2.5.0
pycparser 2.19
pyflakes 2.1.1
Pygments 2.4.2
pymdown-extensions 6.0
pyparsing 2.4.2
pytest 5.0.1
pytest-asyncio 0.10.0
pytest-cov 2.7.1
PyYAML 5.1.2
rfc3986 1.3.2
setuptools 40.8.0
six 1.12.0
toml 0.10.0
tornado 6.0.3
trustme 0.5.2
typed-ast 1.4.0
typing-extensions 3.7.4
uvicorn 0.8.6
wcwidth 0.1.7
websockets 7.0
zipp 0.5.2
___ test_write_timeout ___
server = <uvicorn.main.Server object at 0x03FD6290>
@pytest.mark.asyncio
async def test_write_timeout(server):
timeout = TimeoutConfig(write_timeout=0.000001)
async with AsyncClient(timeout=timeout) as client:
with pytest.raises(WriteTimeout):
data = b"*" * 1024 * 1024 * 100
> await client.put("http://127.0.0.1:8000/slow_response", data=data)
E Failed: DID NOT RAISE <class 'httpx.exceptions.WriteTimeout'>
tests\test_timeouts.py:30: Failed
--- Captured log setup ---
INFO uvicorn:main.py:321 Started server process [2180]
INFO uvicorn:main.py:381 Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
--- Captured log call ---
INFO uvicorn:h11_impl.py:443 ('127.0.0.1', 59595) - "PUT /slow_response HTTP/1.1" 200
--- Captured log teardown ---
INFO uvicorn:main.py:418 Shutting down
INFO uvicorn:main.py:327 Finished server process [2180]
=== 1 failed, 236 passed in 18.31 seconds ===
Hmmm, might have something to do with your system being Windows since we only test on Linux. I'm in the middle of a move atm so my windows machine is packed away but if anyone else has a machine they could try to reproduce this issue and potentially fix it!
I鈥檓 probably the best person to take this on, since I think there鈥檚 some tweaks needed here that never quite made it in when I was working on it.
The behaviour that we need is a bit involved:
We now have the behavior described in the previous comment, so I think this issue is now defunct.