Skip to content

Commit 6ac2ab0

Browse files
authored
Merge pull request #13 from RazerM/test-asyncio
Test async functions using asyncio
2 parents 66c0c86 + 9ed2bee commit 6ac2ab0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

test-requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
pytest
22
pytest-cov
3-
trio; python_version >= '3.5'
4-
pytest-trio; python_version >= '3.5'
3+
pytest-asyncio; python_version >= '3.5'
4+
async-generator; python_version >= '3.5'

tests/test_async.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1+
import asyncio
12
import sys
23

34
import pytest
4-
import trio
55
from async_generator import async_generator, yield_
66

77
import outcome
88
from outcome import AlreadyUsedError, Error, Value
99

10-
pytestmark = pytest.mark.trio
10+
pytestmark = pytest.mark.asyncio
1111

1212

1313
async def test_acapture():
1414
async def add(x, y):
15-
await trio.hazmat.checkpoint()
15+
await asyncio.sleep(0)
1616
return x + y
1717

1818
v = await outcome.acapture(add, 3, y=4)
1919
assert v == Value(7)
2020

2121
async def raise_ValueError(x):
22-
await trio.hazmat.checkpoint()
22+
await asyncio.sleep(0)
2323
raise ValueError(x)
2424

2525
e = await outcome.acapture(raise_ValueError, 9)

0 commit comments

Comments
 (0)