Skip to content

Commit e0cbc7b

Browse files
author
Andrei Neagu
committed
fixed tests
1 parent 0452113 commit e0cbc7b

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

packages/service-library/tests/aiohttp/long_running_tasks/test_long_running_tasks.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,28 @@
2323
from servicelib.aiohttp.rest_middlewares import append_rest_middlewares
2424
from servicelib.long_running_tasks.models import TaskGet, TaskId, TaskStatus
2525
from servicelib.long_running_tasks.task import TaskContext
26+
from settings_library.redis import RedisSettings
2627
from tenacity.asyncio import AsyncRetrying
2728
from tenacity.retry import retry_if_exception_type
2829
from tenacity.stop import stop_after_delay
2930
from tenacity.wait import wait_fixed
3031

32+
pytest_simcore_core_services_selection = [
33+
"redis",
34+
]
35+
3136

3237
@pytest.fixture
33-
def app(server_routes: web.RouteTableDef) -> web.Application:
38+
def app(
39+
server_routes: web.RouteTableDef, redis_service: RedisSettings
40+
) -> web.Application:
3441
app = web.Application()
3542
app.add_routes(server_routes)
3643
# this adds enveloping and error middlewares
3744
append_rest_middlewares(app, api_version="")
38-
long_running_tasks.server.setup(app, router_prefix="/futures")
45+
long_running_tasks.server.setup(
46+
app, redis_settings=redis_service, namespace="test", router_prefix="/futures"
47+
)
3948

4049
return app
4150

packages/service-library/tests/aiohttp/long_running_tasks/test_long_running_tasks_client.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,25 @@
1515
long_running_task_request,
1616
)
1717
from servicelib.aiohttp.rest_middlewares import append_rest_middlewares
18+
from settings_library.redis import RedisSettings
1819
from yarl import URL
1920

21+
pytest_simcore_core_services_selection = [
22+
"redis",
23+
]
24+
2025

2126
@pytest.fixture
22-
def app(server_routes: web.RouteTableDef) -> web.Application:
27+
def app(
28+
server_routes: web.RouteTableDef, redis_service: RedisSettings
29+
) -> web.Application:
2330
app = web.Application()
2431
app.add_routes(server_routes)
2532
# this adds enveloping and error middlewares
2633
append_rest_middlewares(app, api_version="")
27-
long_running_tasks.server.setup(app, router_prefix="/futures")
34+
long_running_tasks.server.setup(
35+
app, redis_settings=redis_service, namespace="test", router_prefix="/futures"
36+
)
2837

2938
return app
3039

packages/service-library/tests/aiohttp/long_running_tasks/test_long_running_tasks_with_task_context.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@
2727
from servicelib.aiohttp.typing_extension import Handler
2828
from servicelib.long_running_tasks.models import TaskGet, TaskId
2929
from servicelib.long_running_tasks.task import TaskContext
30+
from settings_library.redis import RedisSettings
3031

32+
pytest_simcore_core_services_selection = [
33+
"redis",
34+
]
3135
# WITH TASK CONTEXT
3236
# NOTE: as the long running task framework may be used in any number of services
3337
# in some cases there might be specific so-called task contexts.
@@ -61,14 +65,18 @@ async def _test_task_context_decorator(
6165

6266
@pytest.fixture
6367
def app_with_task_context(
64-
server_routes: web.RouteTableDef, task_context_decorator
68+
server_routes: web.RouteTableDef,
69+
task_context_decorator,
70+
redis_service: RedisSettings,
6571
) -> web.Application:
6672
app = web.Application()
6773
app.add_routes(server_routes)
6874
# this adds enveloping and error middlewares
6975
append_rest_middlewares(app, api_version="")
7076
long_running_tasks.server.setup(
7177
app,
78+
redis_settings=redis_service,
79+
namespace="test",
7280
router_prefix="/futures_with_task_context",
7381
task_request_context_decorator=task_context_decorator,
7482
)

0 commit comments

Comments
 (0)