Skip to content

Commit 9604eff

Browse files
committed
removing deprecated fixture
1 parent 98ced40 commit 9604eff

File tree

9 files changed

+14
-49
lines changed

9 files changed

+14
-49
lines changed

packages/pytest-simcore/src/pytest_simcore/traefik_service.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# pylint:disable=redefined-outer-name
44

55

6-
import asyncio
7-
86
import aiohttp
97
import pytest
108
import tenacity
@@ -37,7 +35,6 @@ def traefik_endpoints(
3735

3836
@pytest.fixture()
3937
async def traefik_service(
40-
event_loop: asyncio.AbstractEventLoop,
4138
traefik_endpoints: tuple[URL, URL, URL],
4239
docker_stack: dict,
4340
) -> tuple[URL, URL, URL]:

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
1010
"""
1111

12-
1312
import asyncio
1413
import json
1514
from collections.abc import Awaitable, Callable
@@ -42,16 +41,12 @@ def app(server_routes: web.RouteTableDef) -> web.Application:
4241

4342

4443
@pytest.fixture
45-
def client(
46-
event_loop: asyncio.AbstractEventLoop,
44+
async def client(
4745
aiohttp_client: Callable,
4846
unused_tcp_port_factory: Callable,
4947
app: web.Application,
5048
) -> TestClient:
51-
52-
return event_loop.run_until_complete(
53-
aiohttp_client(app, server_kwargs={"port": unused_tcp_port_factory()})
54-
)
49+
return await aiohttp_client(app, server_kwargs={"port": unused_tcp_port_factory()})
5550

5651

5752
async def test_workflow(

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,12 @@ def app(server_routes: web.RouteTableDef) -> web.Application:
3030

3131

3232
@pytest.fixture
33-
def client(
34-
event_loop: asyncio.AbstractEventLoop,
33+
async def client(
3534
aiohttp_client: Callable,
3635
unused_tcp_port_factory: Callable,
3736
app: web.Application,
3837
) -> TestClient:
39-
return event_loop.run_until_complete(
40-
aiohttp_client(app, server_kwargs={"port": unused_tcp_port_factory()})
41-
)
38+
return await aiohttp_client(app, server_kwargs={"port": unused_tcp_port_factory()})
4239

4340

4441
@pytest.fixture

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
1010
"""
1111

12-
13-
import asyncio
1412
from collections.abc import Awaitable, Callable
1513
from functools import wraps
1614
from typing import Optional
@@ -79,17 +77,13 @@ def app_with_task_context(
7977

8078

8179
@pytest.fixture
82-
def client_with_task_context(
83-
event_loop: asyncio.AbstractEventLoop,
80+
async def client_with_task_context(
8481
aiohttp_client: Callable,
8582
unused_tcp_port_factory: Callable,
8683
app_with_task_context: web.Application,
8784
) -> TestClient:
88-
89-
return event_loop.run_until_complete(
90-
aiohttp_client(
91-
app_with_task_context, server_kwargs={"port": unused_tcp_port_factory()}
92-
)
85+
return await aiohttp_client(
86+
app_with_task_context, server_kwargs={"port": unused_tcp_port_factory()}
9387
)
9488

9589

packages/service-library/tests/aiohttp/test_monitoring.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# pylint: disable=unused-variable
44

55

6-
from asyncio import AbstractEventLoop
76
from collections.abc import Callable
87
from typing import Any
98

@@ -21,8 +20,7 @@
2120

2221

2322
@pytest.fixture
24-
def client(
25-
event_loop: AbstractEventLoop,
23+
async def client(
2624
aiohttp_client: Callable,
2725
unused_tcp_port_factory: Callable,
2826
) -> TestClient:
@@ -40,9 +38,7 @@ async def monitored_request(request: web.Request) -> web.Response:
4038

4139
setup_monitoring(app, app_name="pytest_app")
4240

43-
return event_loop.run_until_complete(
44-
aiohttp_client(app, server_kwargs={"port": ports[0]})
45-
)
41+
return await aiohttp_client(app, server_kwargs={"port": ports[0]})
4642

4743

4844
def _assert_metrics_contain_entry(

packages/service-library/tests/aiohttp/test_rest_middlewares.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ async def raise_success_with_text(_request: web.Request):
129129

130130

131131
@pytest.fixture
132-
def client(
133-
event_loop: asyncio.AbstractEventLoop,
132+
async def client(
134133
aiohttp_client: Callable,
135134
monkeypatch: pytest.MonkeyPatch,
136135
):
@@ -175,7 +174,7 @@ def client(
175174
app.middlewares.append(error_middleware_factory(api_version="/v1"))
176175
app.middlewares.append(envelope_middleware_factory(api_version="/v1"))
177176

178-
return event_loop.run_until_complete(aiohttp_client(app))
177+
return await aiohttp_client(app)
179178

180179

181180
@pytest.mark.parametrize(

services/api-server/tests/unit/test_utils_http_calls_capture.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# pylint: disable=too-many-arguments
55

66

7-
import asyncio
87
import re
98
from pathlib import Path
109

@@ -17,9 +16,7 @@
1716
from pytest_simcore.helpers.httpx_calls_capture_models import HttpApiCallCaptureModel
1817

1918

20-
async def test_capture_http_call(
21-
event_loop: asyncio.AbstractEventLoop, httpbin_base_url: HttpUrl
22-
):
19+
async def test_capture_http_call(httpbin_base_url: HttpUrl):
2320
# CAPTURE
2421
async with httpx.AsyncClient() as client:
2522
response: httpx.Response = await client.get(f"{httpbin_base_url}json")
@@ -56,9 +53,7 @@ async def test_capture_http_call(
5653
assert response.status_code == captured.status_code
5754

5855

59-
async def test_capture_http_dynamic_call(
60-
event_loop: asyncio.AbstractEventLoop, faker: Faker, httpbin_base_url: str
61-
):
56+
async def test_capture_http_dynamic_call(faker: Faker, httpbin_base_url: str):
6257
# CAPTURE
6358
async with httpx.AsyncClient() as client:
6459
sample_uid = faker.uuid4() # used during test sampling

services/dask-sidecar/tests/unit/test_computational_sidecar_tasks.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,9 +535,8 @@ async def subscribe_and_process(a_mock: mock.AsyncMock):
535535
_logger.warning("RabbitMQ worker thread did not terminate properly")
536536

537537

538-
def test_run_computational_sidecar_real_fct(
538+
async def test_run_computational_sidecar_real_fct(
539539
caplog_info_level: pytest.LogCaptureFixture,
540-
event_loop: asyncio.AbstractEventLoop,
541540
app_environment: EnvVarsDict,
542541
dask_subsystem_mock: dict[str, mock.Mock],
543542
sleeper_task: ServiceExampleParam,

services/dask-sidecar/tests/unit/test_utils_gpus.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# pylint: disable=redefined-outer-name
44

55

6-
import asyncio
76
from unittest import mock
87

98
import aiodocker
@@ -25,7 +24,6 @@ def mock_aiodocker(mocker: MockerFixture) -> mock.MagicMock:
2524

2625

2726
def test_num_available_gpus_returns_0_when_container_not_created(
28-
event_loop: asyncio.events.AbstractEventLoop,
2927
app_environment: EnvVarsDict,
3028
mock_aiodocker: mock.MagicMock,
3129
):
@@ -37,7 +35,6 @@ def test_num_available_gpus_returns_0_when_container_not_created(
3735

3836

3937
def test_num_available_gpus_returns_0_when_container_throws_exception_on_run(
40-
event_loop: asyncio.events.AbstractEventLoop,
4138
app_environment: EnvVarsDict,
4239
mock_aiodocker: mock.MagicMock,
4340
):
@@ -50,7 +47,6 @@ def test_num_available_gpus_returns_0_when_container_throws_exception_on_run(
5047

5148

5249
def test_num_available_gpus_returns_0_when_no_status_code_returned(
53-
event_loop: asyncio.events.AbstractEventLoop,
5450
app_environment: EnvVarsDict,
5551
mock_aiodocker: mock.MagicMock,
5652
):
@@ -61,7 +57,6 @@ def test_num_available_gpus_returns_0_when_no_status_code_returned(
6157

6258

6359
def test_num_available_gpus_returns_0_when_bad_status_code_returned(
64-
event_loop: asyncio.events.AbstractEventLoop,
6560
app_environment: EnvVarsDict,
6661
mock_aiodocker: mock.MagicMock,
6762
):
@@ -72,7 +67,6 @@ def test_num_available_gpus_returns_0_when_bad_status_code_returned(
7267

7368

7469
def test_num_available_gpus_returns_0_when_container_wait_timesout(
75-
event_loop: asyncio.events.AbstractEventLoop,
7670
app_environment: EnvVarsDict,
7771
mock_aiodocker: mock.MagicMock,
7872
):
@@ -87,7 +81,6 @@ def test_num_available_gpus_returns_0_when_container_wait_timesout(
8781
[([], 0), (["gpu1"], 1), (["gpu1", "gpu2", "gpu4"], 3)],
8882
)
8983
def test_num_available_gpus(
90-
event_loop: asyncio.events.AbstractEventLoop,
9184
app_environment: EnvVarsDict,
9285
container_logs: list[str],
9386
expected_num_gpus: int,

0 commit comments

Comments
 (0)