|
7 | 7 | from models_library.projects import ProjectAtDB, ProjectID |
8 | 8 | from models_library.projects_nodes_io import NodeID |
9 | 9 | from models_library.projects_state import RunningState |
10 | | -from pydantic import parse_obj_as |
| 10 | +from pydantic import TypeAdapter |
11 | 11 | from simcore_postgres_database.models.comp_runs import comp_runs |
12 | 12 | from simcore_postgres_database.models.comp_tasks import comp_tasks |
13 | 13 | from simcore_service_director_v2.models.comp_pipelines import CompPipelineAtDB |
@@ -68,7 +68,7 @@ async def assert_comp_runs( |
68 | 68 | if where_statement is not None: |
69 | 69 | query = query.where(where_statement) |
70 | 70 | 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) |
72 | 72 | ] |
73 | 73 | assert len(list_of_comp_runs) == expected_total |
74 | 74 | if list_of_comp_runs and expected_state: |
@@ -98,7 +98,7 @@ async def assert_comp_tasks( |
98 | 98 | & (comp_tasks.c.node_id.in_([f"{n}" for n in task_ids])) |
99 | 99 | ) # there is only one entry |
100 | 100 | ) |
101 | | - tasks = parse_obj_as(list[CompTaskAtDB], result.fetchall()) |
| 101 | + tasks = TypeAdapter(list[CompTaskAtDB]).validate_python(result.fetchall()) |
102 | 102 | assert all( |
103 | 103 | t.state == expected_state for t in tasks |
104 | 104 | ), f"expected state: {expected_state}, found: {[t.state for t in tasks]}" |
|
0 commit comments