Skip to content

Commit 2c04660

Browse files
committed
minor
1 parent 2d8d4fe commit 2c04660

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
get_default_product_name,
6767
get_or_create_product_group,
6868
)
69+
from simcore_service_director.core.settings import get_application_settings
6970
from simcore_service_webserver._constants import INDEX_RESOURCE_NAME
7071
from simcore_service_webserver.application import create_application
7172
from simcore_service_webserver.application_settings_utils import AppConfigDict
@@ -97,6 +98,7 @@ def disable_swagger_doc_generation(
9798
def docker_compose_env(default_app_cfg: AppConfigDict) -> Iterator[pytest.MonkeyPatch]:
9899
postgres_cfg = default_app_cfg["db"]["postgres"]
99100
redis_cfg = default_app_cfg["resource_manager"]["redis"]
101+
100102
# docker-compose reads these environs
101103
with pytest.MonkeyPatch().context() as patcher:
102104
patcher.setenv("TEST_POSTGRES_DB", postgres_cfg["database"])
@@ -119,24 +121,25 @@ def docker_compose_file(docker_compose_env: pytest.MonkeyPatch) -> str:
119121

120122

121123
@pytest.fixture
122-
def web_test_server_port(unused_tcp_port_factory: Callable):
124+
def webserver_test_server_port(unused_tcp_port_factory: Callable):
125+
# used to create a TestServer that emulates web-server service
123126
return unused_tcp_port_factory()
124127

125128

126129
@pytest.fixture
127130
def storage_test_server_port(
128-
unused_tcp_port_factory: Callable, web_test_server_port: int
131+
unused_tcp_port_factory: Callable, webserver_test_server_port: int
129132
):
133+
# used to create a TestServer that emulates storage service
130134
port = unused_tcp_port_factory()
131-
assert port != web_test_server_port
135+
assert port != webserver_test_server_port
132136
return port
133137

134138

135139
@pytest.fixture
136140
def app_environment(
137141
monkeypatch: pytest.MonkeyPatch,
138142
default_app_cfg: AppConfigDict,
139-
unused_tcp_port_factory: Callable,
140143
mock_env_devel_environment: EnvVarsDict,
141144
storage_test_server_port: int,
142145
monkeypatch_setenv_from_app_config: Callable[[AppConfigDict], EnvVarsDict],
@@ -201,23 +204,23 @@ async def _print_mail_to_stdout(
201204
@pytest.fixture
202205
def web_server(
203206
event_loop: asyncio.AbstractEventLoop,
204-
unused_tcp_port_factory: Callable,
205207
app_environment: EnvVarsDict,
206208
postgres_db: sa.engine.Engine,
207-
web_test_server_port: int,
209+
webserver_test_server_port: int,
208210
# tools
209211
aiohttp_server: Callable,
210212
mocked_send_email: None,
211213
disable_static_webserver: Callable,
212214
) -> TestServer:
215+
assert app_environment
213216

214217
# original APP
215218
app = create_application()
216219

217220
disable_static_webserver(app)
218221

219222
server = event_loop.run_until_complete(
220-
aiohttp_server(app, port=web_test_server_port)
223+
aiohttp_server(app, port=webserver_test_server_port)
221224
)
222225

223226
assert isinstance(postgres_db, sa.engine.Engine)

0 commit comments

Comments
 (0)