@@ -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
@@ -938,21 +958,6 @@ def test_loop_call_later_handle_when_after_fired(self):
938958 self .loop .run_until_complete (fut )
939959 self .assertEqual (handle .when (), when )
940960
941- def test_thread_name_prefix_in_default_executor (self ):
942- called = []
943-
944- def cb ():
945- called .append (threading .current_thread ().name )
946-
947- async def runner ():
948- await self .loop .run_in_executor (None , cb )
949-
950- self .loop .run_until_complete (runner ())
951-
952- self .assertEqual (len (called ), 1 )
953- self .assertTrue (called [0 ] is not None )
954- self .assertTrue (called [0 ].startswith ("uvloop" ))
955-
956961
957962class TestBaseAIO (_TestBase , AIOTestCase ):
958963 pass
0 commit comments