Skip to content

Commit b0c63c9

Browse files
committed
fix(sftkit): proper usage of async generator type annotations
1 parent 9fa9693 commit b0c63c9

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

sftkit/tests/conftest.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,24 @@ def db_config() -> DatabaseConfig:
2525

2626

2727
@pytest_asyncio.fixture(loop_scope="session", scope="session")
28-
async def static_test_db_pool(db_config: DatabaseConfig) -> AsyncGenerator[Pool]:
28+
async def static_test_db_pool(db_config: DatabaseConfig) -> AsyncGenerator[Pool, None]:
2929
pool = await create_db_pool(cfg=db_config, n_connections=10)
3030
yield pool
3131
await pool.close()
3232

3333

3434
@pytest_asyncio.fixture(loop_scope="session", scope="function")
35-
async def test_db(db_config: DatabaseConfig, static_test_db_pool: Pool) -> AsyncGenerator[Database]:
35+
async def test_db(
36+
db_config: DatabaseConfig, static_test_db_pool: Pool
37+
) -> AsyncGenerator[Database, None]:
3638
dbname = "".join(random.choices(string.ascii_lowercase, k=20))
3739
cfg = db_config.model_copy()
3840
cfg.dbname = dbname
3941
await static_test_db_pool.execute(f'create database "{dbname}"')
4042
if db_config.user:
41-
await static_test_db_pool.execute(f'alter database "{dbname}" owner to "{db_config.user}"')
43+
await static_test_db_pool.execute(
44+
f'alter database "{dbname}" owner to "{db_config.user}"'
45+
)
4246
mininal_db_assets = ASSETS_DIR / "minimal_db"
4347
database = Database(
4448
config=cfg,
@@ -51,14 +55,14 @@ async def test_db(db_config: DatabaseConfig, static_test_db_pool: Pool) -> Async
5155

5256

5357
@pytest_asyncio.fixture(loop_scope="session", scope="function")
54-
async def test_db_pool(test_db: Database) -> AsyncGenerator[Pool]:
58+
async def test_db_pool(test_db: Database) -> AsyncGenerator[Pool, None]:
5559
pool = await test_db.create_pool(n_connections=10)
5660
yield pool
5761
await pool.close()
5862

5963

6064
@pytest_asyncio.fixture(loop_scope="session", scope="function")
61-
async def test_db_conn(test_db_pool: Pool) -> AsyncGenerator[Connection]:
65+
async def test_db_conn(test_db_pool: Pool) -> AsyncGenerator[Connection, None]:
6266
async with test_db_pool.acquire() as conn:
6367
yield conn
6468

0 commit comments

Comments
 (0)