Skip to content

Commit cc0808f

Browse files
committed
cleanup
1 parent 8708ba3 commit cc0808f

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

services/web/server/tests/sandbox/app.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from aiohttp import web
77
from aiohttp.web import middleware
88
from multidict import MultiDict
9-
109
from simcore_service_webserver._meta import api_vtag
1110

1211
# FRONT_END ####################################
@@ -91,7 +90,7 @@ async def discover_product_middleware(request, handler):
9190
request[RQ_PRODUCT_NAME_KEY] = frontend_app
9291

9392
else:
94-
#/s4/boot.js is called with 'Referer': 'http://localhost:9081/s4l/index.html'
93+
# /s4/boot.js is called with 'Referer': 'http://localhost:9081/s4l/index.html'
9594

9695
# if path to index
9796
match = PRODUCT_PATH_RE.match(request.path)
@@ -102,7 +101,7 @@ async def discover_product_middleware(request, handler):
102101
response = await handler(request)
103102

104103
# FIXME: notice that if raised error, it will not be attached
105-
#if RQ_PRODUCT_NAME_KEY in request:
104+
# if RQ_PRODUCT_NAME_KEY in request:
106105
# response.headers[PRODUCT_NAME_HEADER] = request[RQ_PRODUCT_NAME_KEY]
107106

108107
return response
@@ -113,7 +112,6 @@ async def discover_product_middleware(request, handler):
113112
async def serve_default_app(request):
114113
# TODO: check url and defined what is the default??
115114
print("Request from", request.headers["Host"])
116-
import pdb; pdb.set_trace()
117115

118116
target_product = request.get(RQ_PRODUCT_NAME_KEY, default_frontend_app)
119117

services/web/server/tests/unit/with_dbs/conftest.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import textwrap
1616
from copy import deepcopy
1717
from pathlib import Path
18-
from typing import Callable, Dict, List, Optional
18+
from typing import Callable, Dict, Iterator, List, Optional
1919
from uuid import uuid4
2020

2121
import aioredis
@@ -99,7 +99,7 @@ def docker_compose_file(default_app_cfg):
9999

100100

101101
@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:
103103
"""Can be overriden in any test module to configure
104104
the app accordingly
105105
"""
@@ -157,7 +157,7 @@ def client(loop, aiohttp_client, web_server, mock_orphaned_services) -> TestClie
157157

158158

159159
@pytest.fixture
160-
def qx_client_outdir(tmpdir):
160+
def qx_client_outdir(tmpdir) -> Path:
161161
"""Emulates qx output at service/web/client after compiling"""
162162

163163
basedir = tmpdir.mkdir("source-output")
@@ -324,11 +324,15 @@ def postgres_service(docker_services, postgres_dsn):
324324

325325

326326
@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
328331
url = postgres_service
329332

330333
# Configures db and initializes tables
331-
pg_cli.discover.callback(**postgres_dsn)
334+
kwargs = postgres_dsn.copy()
335+
pg_cli.discover.callback(**kwargs)
332336
pg_cli.upgrade.callback("head")
333337
# Uses syncrounous engine for that
334338
engine = sa.create_engine(url, isolation_level="AUTOCOMMIT")
@@ -384,7 +388,7 @@ def create_url(client_override: Optional[TestClient] = None) -> str:
384388
SOCKET_IO_PATH = "/socket.io/"
385389
return str((client_override or client).make_url(SOCKET_IO_PATH))
386390

387-
yield create_url
391+
return create_url
388392

389393

390394
@pytest.fixture()
@@ -403,7 +407,7 @@ async def creator(client_override: Optional[TestClient] = None) -> str:
403407
)
404408
return cookie
405409

406-
yield creator
410+
return creator
407411

408412

409413
@pytest.fixture()

0 commit comments

Comments
 (0)