diff --git a/tests/test_base.py b/tests/test_base.py index 86bbd1d0..8e6fbe27 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -869,6 +869,21 @@ def test_loop_call_later_handle_when_after_fired(self): self.loop.run_until_complete(fut) self.assertEqual(handle.when(), when) + def test_thread_name_prefix_in_default_executor(self): + called = [] + + def cb(): + called.append(threading.current_thread().name) + + async def runner(): + await self.loop.run_in_executor(None, cb) + + self.loop.run_until_complete(runner()) + + self.assertEqual(len(called), 1) + self.assertTrue(called[0] is not None) + self.assertTrue(called[0].startswith("uvloop")) + class TestBaseAIO(_TestBase, AIOTestCase): pass diff --git a/uvloop/loop.pyx b/uvloop/loop.pyx index f9a5a239..d6e18709 100644 --- a/uvloop/loop.pyx +++ b/uvloop/loop.pyx @@ -2741,7 +2741,7 @@ cdef class Loop: # Only check when the default executor is being used self._check_default_executor() if executor is None: - executor = cc_ThreadPoolExecutor() + executor = cc_ThreadPoolExecutor(thread_name_prefix='uvloop') self._default_executor = executor return aio_wrap_future(executor.submit(func, *args), loop=self)