Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion uvloop/loop.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading