Skip to content

Commit

Permalink
feat(test): test_task.py
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler authored Feb 3, 2024
1 parent 76eab0e commit c910ca9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest

from a_sync import create_task

@pytest.marks.asyncio
async def test_create_task():
await create_task(coro=asyncio.sleep(0), name='test')

@pytest.marks.asyncio
async def test_persistent_task():
check = False
async def task():
await asyncio.sleep(1)
nonlocal check
check = True
create_task(coro=task(), skip_gc_until_done=True)
# there is no local reference to the newly created task. does it still complete?
await asyncio.sleep(2)
assert check is True

0 comments on commit c910ca9

Please sign in to comment.