Skip to content

Commit 250a9c0

Browse files
continue fixing
1 parent 92a40de commit 250a9c0

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

services/director-v2/tests/unit/test_modules_dask_clients_pool.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from typing import Any, AsyncIterator, Callable, get_args
88
from unittest import mock
99

10+
from common_library.json_serialization import json_dumps
11+
from common_library.serialization import model_dump_with_secrets
1012
import pytest
1113
from _dask_helpers import DaskGatewayServer
1214
from distributed.deploy.spec import SpecCluster
@@ -126,10 +128,14 @@ def creator():
126128
)
127129
monkeypatch.setenv(
128130
"COMPUTATIONAL_BACKEND_DEFAULT_CLUSTER_AUTH",
129-
SimpleAuthentication(
130-
username=faker.user_name(),
131-
password=SecretStr(local_dask_gateway_server.password),
132-
).json(encoder=create_json_encoder_wo_secrets(SimpleAuthentication)),
131+
json_dumps(
132+
model_dump_with_secrets(
133+
SimpleAuthentication(
134+
username=faker.user_name(),
135+
password=SecretStr(local_dask_gateway_server.password),
136+
), show_secrets=True
137+
)
138+
)
133139
)
134140

135141
return creator
@@ -194,11 +200,11 @@ async def test_dask_clients_pool_acquisition_creates_client_on_demand(
194200
cluster_type=ClusterTypeInModel.ON_PREMISE,
195201
)
196202
)
197-
async with clients_pool.acquire(cluster) as dask_client:
203+
async with clients_pool.acquire(cluster):
198204
# on start it is created
199205
mocked_dask_client.create.assert_has_calls(mocked_creation_calls)
200206

201-
async with clients_pool.acquire(cluster) as dask_client:
207+
async with clients_pool.acquire(cluster):
202208
# the connection already exists, so there is no new call to create
203209
mocked_dask_client.create.assert_has_calls(mocked_creation_calls)
204210

@@ -278,5 +284,5 @@ def just_a_quick_fct(x, y):
278284
)
279285
future = dask_client.backend.client.submit(just_a_quick_fct, 12, 23)
280286
assert future
281-
result = await future.result(timeout=10) # type: ignore
287+
result = await future.result(timeout=10)
282288
assert result == 35

0 commit comments

Comments
 (0)