Skip to content

Commit 5eddd93

Browse files
committed
pyv2
1 parent b27fce6 commit 5eddd93

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from models_library.projects import ProjectAtDB, ProjectID
88
from models_library.projects_nodes_io import NodeID
99
from models_library.projects_state import RunningState
10-
from pydantic import parse_obj_as
10+
from pydantic import TypeAdapter
1111
from simcore_postgres_database.models.comp_runs import comp_runs
1212
from simcore_postgres_database.models.comp_tasks import comp_tasks
1313
from simcore_service_director_v2.models.comp_pipelines import CompPipelineAtDB
@@ -68,7 +68,7 @@ async def assert_comp_runs(
6868
if where_statement is not None:
6969
query = query.where(where_statement)
7070
list_of_comp_runs = [
71-
CompRunsAtDB.from_orm(row) for row in await conn.execute(query)
71+
CompRunsAtDB.model_validate(row) for row in await conn.execute(query)
7272
]
7373
assert len(list_of_comp_runs) == expected_total
7474
if list_of_comp_runs and expected_state:
@@ -98,7 +98,7 @@ async def assert_comp_tasks(
9898
& (comp_tasks.c.node_id.in_([f"{n}" for n in task_ids]))
9999
) # there is only one entry
100100
)
101-
tasks = parse_obj_as(list[CompTaskAtDB], result.fetchall())
101+
tasks = TypeAdapter(list[CompTaskAtDB]).validate_python(result.fetchall())
102102
assert all(
103103
t.state == expected_state for t in tasks
104104
), f"expected state: {expected_state}, found: {[t.state for t in tasks]}"

0 commit comments

Comments
 (0)