15
15
import textwrap
16
16
from copy import deepcopy
17
17
from pathlib import Path
18
- from typing import Callable , Dict , List , Optional
18
+ from typing import Callable , Dict , Iterator , List , Optional
19
19
from uuid import uuid4
20
20
21
21
import aioredis
@@ -99,7 +99,7 @@ def docker_compose_file(default_app_cfg):
99
99
100
100
101
101
@pytest .fixture (scope = "function" )
102
- def app_cfg (default_app_cfg , aiohttp_unused_port ):
102
+ def app_cfg (default_app_cfg , aiohttp_unused_port ) -> Dict :
103
103
"""Can be overriden in any test module to configure
104
104
the app accordingly
105
105
"""
@@ -157,7 +157,7 @@ def client(loop, aiohttp_client, web_server, mock_orphaned_services) -> TestClie
157
157
158
158
159
159
@pytest .fixture
160
- def qx_client_outdir (tmpdir ):
160
+ def qx_client_outdir (tmpdir ) -> Path :
161
161
"""Emulates qx output at service/web/client after compiling"""
162
162
163
163
basedir = tmpdir .mkdir ("source-output" )
@@ -324,11 +324,15 @@ def postgres_service(docker_services, postgres_dsn):
324
324
325
325
326
326
@pytest .fixture
327
- def postgres_db (postgres_dsn : Dict , postgres_service : str ) -> sa .engine .Engine :
327
+ def postgres_db (
328
+ postgres_dsn : Dict , postgres_service : str
329
+ ) -> Iterator [sa .engine .Engine ]:
330
+ # Overrides packages/pytest-simcore/src/pytest_simcore/postgres_service.py::postgres_db to reduce scope
328
331
url = postgres_service
329
332
330
333
# Configures db and initializes tables
331
- pg_cli .discover .callback (** postgres_dsn )
334
+ kwargs = postgres_dsn .copy ()
335
+ pg_cli .discover .callback (** kwargs )
332
336
pg_cli .upgrade .callback ("head" )
333
337
# Uses syncrounous engine for that
334
338
engine = sa .create_engine (url , isolation_level = "AUTOCOMMIT" )
@@ -384,7 +388,7 @@ def create_url(client_override: Optional[TestClient] = None) -> str:
384
388
SOCKET_IO_PATH = "/socket.io/"
385
389
return str ((client_override or client ).make_url (SOCKET_IO_PATH ))
386
390
387
- yield create_url
391
+ return create_url
388
392
389
393
390
394
@pytest .fixture ()
@@ -403,7 +407,7 @@ async def creator(client_override: Optional[TestClient] = None) -> str:
403
407
)
404
408
return cookie
405
409
406
- yield creator
410
+ return creator
407
411
408
412
409
413
@pytest .fixture ()
0 commit comments