AttributeError when running example code
Closed this issue · 3 comments
I'm running the example found in the project description and I get this error:
AttributeError: 'tuple' object has no attribute 'family'
I'm using Python 3.5.1, aiohttp==0.20.1, webtest-aiohttp==1.0.0
Running the example code requires changing app.router.add_route('GET', '/', handler)
to app.router.add_route('GET', '/', hello)
and adding json to the imports.
Thanks!!
I'm running the same python and aiohttp and am having this issue as well.
Except, this code was working the other day. A colleague of mine was having this issue so I wiped my venv and started from scratch. After installing again, this issue started. It seems like the _socket that aiohttp is setting isn't being set correctly, since it's attempting to access it's "family" attribute and it appears that attribute doesn't exist.
When I run your test in my virtual env the problem also persists. I'm using the baseline 20.2 py package for aiohttp.
Yeah, this is a known compatibility bug with the latest version of aiohttp. If you are using pytest, you can work around the issue using monkeypatch
. See these lines in webargs
: https://github.com/sloria/webargs/blob/8b233e63a7228a23a8ce5e498ed0ccc6ab981075/tests/test_aiohttp/conftest.py#L18-L23 . h/t to Muffin for this workaround.
Closing this; webtest-aiohttp is now compatible with aiohttp>=0.21