Skip to content

Commit 1154729

Browse files
committed
Workaround uvloop SSL issue
1 parent e8cc627 commit 1154729

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

tests/test_connect.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -815,11 +815,17 @@ async def test_ssl_connection_custom_context(self):
815815
await con.close()
816816

817817
async def test_ssl_connection_default_context(self):
818-
with self.assertRaisesRegex(ssl.SSLError, 'verify failed'):
819-
await self.connect(
820-
host='localhost',
821-
user='ssl_user',
822-
ssl=True)
818+
# XXX: uvloop artifact
819+
old_handler = self.loop.get_exception_handler()
820+
try:
821+
self.loop.set_exception_handler(lambda *args: None)
822+
with self.assertRaisesRegex(ssl.SSLError, 'verify failed'):
823+
await self.connect(
824+
host='localhost',
825+
user='ssl_user',
826+
ssl=True)
827+
finally:
828+
self.loop.set_exception_handler(old_handler)
823829

824830
async def test_ssl_connection_pool(self):
825831
ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)

0 commit comments

Comments
 (0)