Skip to content

Commit 0814105

Browse files
committed
Add async Python callbacks test that runs in separate Python thread
1 parent 296627b commit 0814105

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/test_callbacks.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22
from pybind11_tests import callbacks as m
3+
from threading import Thread
34

45

56
def test_callbacks():
@@ -127,3 +128,9 @@ def gen_f():
127128
from time import sleep
128129
sleep(0.5)
129130
assert sum(res) == sum([x + 3 for x in work])
131+
132+
133+
def test_async_async_callbacks():
134+
t = Thread(target=test_async_callbacks)
135+
t.start()
136+
t.join()

0 commit comments

Comments
 (0)