File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed
Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 1919class _TestAiodns :
2020 def test_dns_query (self ):
2121 # This is not allowed to fail...
22- resolver = aiodns .DNSResolver (loop = self .loop )
22+ resolver = aiodns .DNSResolver ([ "8.8.8.8" , "8.8.4.4" ], loop = self .loop )
2323
2424 async def test ():
2525 async def query (name , query_type ):
26- return await resolver .query (name , query_type )
26+ return await resolver .query_dns (name , query_type )
2727
2828 await query ("google.com" , "A" )
2929 await query ("httpbin.org" , "A" )
Original file line number Diff line number Diff line change 99import asyncio
1010import sys
1111import unittest
12+ import warnings # Needed for suppressing aiohttp NotAppKeyWarning (temporary patch)
1213import weakref
1314
1415from winloop import _testbase as tb
@@ -78,16 +79,20 @@ async def on_shutdown(app):
7879 app = aiohttp .web .Application ()
7980 app .router .add_get ("/" , websocket_handler )
8081 app .on_shutdown .append (on_shutdown )
81- app ["websockets" ] = weakref .WeakSet ()
82+
83+ with warnings .catch_warnings ():
84+ # Just filter it for now. A workaround will be utilized in the future...
85+ warnings .filterwarnings ("ignore" , category = aiohttp .web .NotAppKeyWarning )
86+ app ["websockets" ] = weakref .WeakSet ()
8287
83- runner = aiohttp .web .AppRunner (app )
88+ runner = aiohttp .web .AppRunner (app , shutdown_timeout = 0.1 )
8489 self .loop .run_until_complete (runner .setup ())
8590 site = aiohttp .web .TCPSite (
8691 runner ,
8792 "0.0.0.0" ,
8893 0 ,
8994 # https://github.com/aio-libs/aiohttp/pull/7188
90- shutdown_timeout = 0.1 ,
95+ # shutdown_timeout=0.1,
9196 )
9297 self .loop .run_until_complete (site .start ())
9398 port = site ._server .sockets [0 ].getsockname ()[1 ]
Original file line number Diff line number Diff line change @@ -101,7 +101,8 @@ def setUp(self):
101101 self .__unhandled_exceptions = []
102102
103103 def tearDown (self ):
104- self .loop .close ()
104+ if self .loop .is_closed :
105+ self .loop .close ()
105106
106107 if self .__unhandled_exceptions :
107108 print ("Unexpected calls to loop.call_exception_handler():" )
@@ -329,7 +330,6 @@ def setUp(self):
329330 def tearDown (self ):
330331 if sys .platform != "win32" and sys .version_info < (3 , 12 ):
331332 asyncio .set_child_watcher (None )
332- super ().tearDown ()
333333
334334 def new_loop (self ):
335335 return asyncio .new_event_loop ()
You can’t perform that action at this time.
0 commit comments