Skip to content

Commit a2be28c

Browse files
committed
asynchronous/thread: add pool parameter tests
Signed-off-by: Matteo Cafasso <[email protected]>
1 parent 672119c commit a2be28c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/test_asynchronous_thread.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import threading
44
import dataclasses
55

6+
from pebble import ThreadPool
67
from 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+
5965
class 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()))

0 commit comments

Comments
 (0)