diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-01-15 20:53:49 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:53 +0100 |
commit | 432d7ffdaf701df556a6d4e45b8e0b75bd887597 (patch) | |
tree | b723799d688fae2ba2f958b3fdbaece9db1864d5 /tests | |
parent | 7a57687d9e6724e78f45755b0206f739c504606d (diff) | |
download | wee-slack-432d7ffdaf701df556a6d4e45b8e0b75bd887597.tar.gz |
Fix async functions returning None and without await never finishing
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_task_runner.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_task_runner.py b/tests/test_task_runner.py index 095b013..33b74a6 100644 --- a/tests/test_task_runner.py +++ b/tests/test_task_runner.py @@ -61,3 +61,19 @@ def test_run_two_tasks_concurrently(): assert not shared.active_futures assert task1.result == ("awaitable", ("data1",)) assert task2.result == ("awaitable", ("data2",)) + + +def test_task_without_await(): + shared.active_tasks = defaultdict(list) + shared.active_futures = {} + + async def fun_without_await(): + pass + + async def run(): + await create_task(fun_without_await()) + + create_task(run()) + + assert not shared.active_tasks + assert not shared.active_futures |