-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add asyncio/anyio taskgroup support to async112
- Loading branch information
Showing
4 changed files
with
74 additions
and
10 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
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
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,28 @@ | ||
# main tests in async112.py | ||
# this only tests anyio.create_task_group in particular | ||
# BASE_LIBRARY anyio | ||
# ASYNCIO_NO_ERROR | ||
# TRIO_NO_ERROR | ||
|
||
import anyio | ||
|
||
|
||
async def bar(*args): ... | ||
|
||
|
||
async def foo(): | ||
async with anyio.create_task_group() as tg: # error: 15, "tg" | ||
await tg.start_soon(bar()) | ||
|
||
async with anyio.create_task_group() as tg: | ||
await tg.start(bar(tg)) | ||
|
||
async with anyio.create_task_group() as tg: # error: 15, "tg" | ||
tg.start_soon(bar()) | ||
|
||
async with anyio.create_task_group() as tg: | ||
tg.start_soon(bar(tg)) | ||
|
||
# will not trigger on create_task | ||
async with anyio.create_task_group() as tg: | ||
tg.create_task(bar()) # type: ignore[attr-defined] |
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,24 @@ | ||
# main tests in async112.py | ||
# this only tests asyncio.TaskGroup in particular | ||
# BASE_LIBRARY asyncio | ||
# ANYIO_NO_ERROR | ||
# TRIO_NO_ERROR | ||
# TaskGroup introduced in 3.11, we run typechecks with 3.9 | ||
# mypy: disable-error-code=attr-defined | ||
|
||
import asyncio | ||
|
||
|
||
async def bar(*args): ... | ||
|
||
|
||
async def foo(): | ||
async with asyncio.TaskGroup() as tg: # error: 15, "tg" | ||
tg.create_task(bar()) | ||
|
||
async with asyncio.TaskGroup() as tg: | ||
tg.create_task(bar(tg)) | ||
|
||
# will not trigger on start / start_soon | ||
async with asyncio.TaskGroup() as tg: | ||
tg.start(bar()) |