File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -799,6 +799,26 @@ async def main():
799799 elif result .returncode != 0 :
800800 self .fail (result .stdout .strip ())
801801
802+ def test_thread_name_prefix_in_default_executor (self ):
803+ if self .implementation == "asyncio" and sys .version_info < (3 , 9 ):
804+ raise unittest .SkipTest (
805+ "thread_name_prefix was added in CPython 3.9"
806+ )
807+
808+ called = []
809+
810+ def cb ():
811+ called .append (threading .current_thread ().name )
812+
813+ async def runner ():
814+ await self .loop .run_in_executor (None , cb )
815+
816+ self .loop .run_until_complete (runner ())
817+
818+ self .assertEqual (len (called ), 1 )
819+ self .assertTrue (called [0 ] is not None )
820+ self .assertTrue (called [0 ].startswith (self .implementation ))
821+
802822
803823class TestBaseUV (_TestBase , UVTestCase ):
804824
Original file line number Diff line number Diff line change @@ -2747,7 +2747,7 @@ cdef class Loop:
27472747 # Only check when the default executor is being used
27482748 self ._check_default_executor()
27492749 if executor is None :
2750- executor = cc_ThreadPoolExecutor()
2750+ executor = cc_ThreadPoolExecutor(thread_name_prefix = ' uvloop ' )
27512751 self ._default_executor = executor
27522752
27532753 return aio_wrap_future(executor.submit(func, * args), loop = self )
You can’t perform that action at this time.
0 commit comments