-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76eab0e
commit c910ca9
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |