Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:
Is there a way this can be tested? I tried simulating OSError for IPv4 address and returning socket for ipv6 one like it resolves correctly. I guess that's the underlying idea of happy eyeballs but a test can be added for basic workflow since it lacks tests. @patch_socket def test_create_connection_happy_eyeballs_exception(self, sock_mock): async def getaddrinfo(*args, **kw): return [(2, 1, 6, '', ('127.0.0.1', 8000)), (2, 1, 6, '', ('::1', 8000, 0, 0)),] def getaddrinfo_task(*args, **kwds): return self.loop.create_task(getaddrinfo(*args, **kwds)) self.loop.getaddrinfo = getaddrinfo_task with mock.patch.object(self.loop, 'sock_connect', side_effect=[OSError, sock_mock]): coro = self.loop.create_connection(MyProto, host='localhost', port=8000, happy_eyeballs_delay=1) transport, _ = self.loop.run_until_complete(coro) transport.close() ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39129> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com