File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 33import threading
44import dataclasses
55
6+ from pebble import ThreadPool
67from pebble import asynchronous
78
89
@@ -56,6 +57,11 @@ def daemon_keyword_decorated():
5657 return threading .current_thread ().daemon
5758
5859
60+ @asynchronous .thread (pool = ThreadPool (1 ))
61+ def pool_decorated (_argument , _keyword_argument = 0 ):
62+ return threading .current_thread ().ident
63+
64+
5965class ThreadAsynchronousObj :
6066 a = 0
6167
@@ -218,3 +224,10 @@ async def test():
218224 return await daemon_keyword_decorated ()
219225
220226 self .assertEqual (asyncio .run (test ()), False )
227+
228+ def test_pool_decorated (self ):
229+ """Thread pool decorated function."""
230+ async def test ():
231+ return await pool_decorated (1 , 1 )
232+
233+ self .assertEqual (asyncio .run (test ()), asyncio .run (test ()))
You can’t perform that action at this time.
0 commit comments