Skip to content

Commit

Permalink
Fix nonexisting domain issue on bad internet connection in client fun…
Browse files Browse the repository at this point in the history
…ctional tests
  • Loading branch information
asvetlov committed Nov 3, 2017
1 parent 1049c86 commit 5513dcd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/test_client_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -2226,7 +2226,17 @@ async def handler(request):


async def test_close_detached_session_on_non_existing_addr(loop):
session = aiohttp.ClientSession(loop=loop)
class FakeResolver(AbstractResolver):
async def resolve(host, port=0, family=socket.AF_INET):
return {}

async def close(self):
pass

connector = aiohttp.TCPConnector(resolver=FakeResolver(),
loop=loop)

session = aiohttp.ClientSession(connector=connector)

async with session:
cm = session.get('http://non-existing.example.com')
Expand Down

0 comments on commit 5513dcd

Please sign in to comment.