Skip to content

Commit 917d541

Browse files
committed
add unit test
Signed-off-by: Shijie Sheng <liouvetren@gmail.com>
1 parent bca3fa9 commit 917d541

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/cadence/_internal/workflow/test_deterministic_event_loop.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,17 @@ def test_create_task(self):
7676
size = 10000
7777
results = self.loop.run_until_complete(coro_await_task(size))
7878
assert results == list(range(size))
79+
80+
def test_run_once(self):
81+
# run once won't clear the read queue
82+
self.loop.create_task(coro_await_task(10))
83+
self.loop.stop()
84+
self.loop.run_forever()
85+
assert len(self.loop._ready) == 10
86+
87+
def test_run_until_yield(self):
88+
# run until yield will clear the read queue
89+
task = self.loop.create_task(coro_await_task(3))
90+
self.loop.run_until_yield()
91+
assert len(self.loop._ready) == 0
92+
assert task.done() is True

0 commit comments

Comments
 (0)