Skip to content

Commit 0404814

Browse files
committed
Use async_generator package to avoid syntax error on python<3.6
1 parent fa27dac commit 0404814

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ pytest==4.3.1
55
six==1.12.0
66
trio==0.11.0
77
pytest-trio==0.5.2
8+
async-generator==1.10

tests/integration/test_trio.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
1+
from collections import namedtuple
12
import os
23
import sys
3-
from collections import namedtuple
4+
5+
from async_generator import async_generator, yield_
46
import pytest
57
from rethinkdb import RethinkDB
68
from rethinkdb.errors import ReqlRuntimeError
79
import trio
810

11+
912
INTEGRATION_TEST_DB = 'integration_test'
1013
r = RethinkDB()
1114
r.set_loop_type('trio')
1215

1316

1417
@pytest.fixture
18+
@async_generator
1519
async def integration_db(nursery):
1620
async with r.open(db='test', nursery=nursery) as conn:
1721
try:
1822
await r.db_create(INTEGRATION_TEST_DB).run(conn)
1923
except ReqlRuntimeError:
2024
pass
21-
yield r.db(INTEGRATION_TEST_DB)
25+
await yield_(r.db(INTEGRATION_TEST_DB))
2226

2327

2428
@pytest.fixture
29+
@async_generator
2530
async def marvel_table(integration_db, nursery):
2631
async with r.open(db='test', nursery=nursery) as conn:
2732
await r.table_create('marvel').run(conn)
28-
yield r.table('marvel')
33+
await yield_(r.table('marvel'))
2934
await r.table_drop('marvel').run(conn)
3035

3136

0 commit comments

Comments
 (0)