Skip to content

Commit e37c99e

Browse files
authored
Merge pull request #49 from fractal-analytics-platform/46_fix_tests
Fix tests after task updates
2 parents d315645 + a7fe676 commit e37c99e

File tree

4 files changed

+54
-34
lines changed

4 files changed

+54
-34
lines changed

poetry.lock

Lines changed: 26 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ fastapi-users-db-sqlmodel = "^0.2.0"
2424
alembic = "^1.8.0"
2525
uvicorn = "^0.18.2"
2626
SQLAlchemy-Utils = "^0.38.3"
27-
fractal-tasks-core = "^0.1.0"
2827
parsl = "^1.3.0dev0"
28+
fractal-tasks-core = "^0.1.3"
2929

3030
[tool.poetry.group.dev.dependencies]
3131
asgi-lifespan = "^1.0.1"

tests/test_apply_worfklow.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
from copy import deepcopy
23
from pathlib import Path
34

45
import pytest
@@ -327,6 +328,14 @@ async def test_create_zarr(
327328
res = await db.execute(stm)
328329
create_ome_zarr_task = res.scalar()
329330

331+
# Modify the task default args
332+
db_task = await db.get(Task, create_ome_zarr_task.id)
333+
current_default_args = deepcopy(db_task._arguments)
334+
current_default_args.update(dict(channel_parameters={"A01_C01": {}}))
335+
setattr(db_task, "default_args", current_default_args)
336+
await db.commit()
337+
await db.refresh(db_task)
338+
330339
await wf.add_subtask(db, subtask=create_ome_zarr_task)
331340
debug(TaskRead.from_orm(wf))
332341

@@ -345,7 +354,7 @@ async def test_create_zarr(
345354
debug(out_ds)
346355
assert out_ds.meta
347356
# FIXME
348-
# The assertion above needs be spcified to the metadata of the task
357+
# The assertion above needs be specified to the metadata of the task
349358

350359

351360
async def test_yokogawa(
@@ -395,6 +404,14 @@ async def test_yokogawa(
395404
res = await db.execute(stm)
396405
create_ome_zarr_task = res.scalar()
397406

407+
# Modify the task default args
408+
db_task = await db.get(Task, create_ome_zarr_task.id)
409+
current_default_args = deepcopy(db_task._arguments)
410+
current_default_args.update(dict(channel_parameters={"A01_C01": {}}))
411+
setattr(db_task, "default_args", current_default_args)
412+
await db.commit()
413+
await db.refresh(db_task)
414+
398415
await wf.add_subtask(
399416
db,
400417
subtask=create_ome_zarr_task,
@@ -405,9 +422,7 @@ async def test_yokogawa(
405422
res = await db.execute(stm)
406423
yokogawa = res.scalar()
407424
await wf.add_subtask(
408-
db,
409-
subtask=yokogawa,
410-
args=dict(parallelization_level="well", rows=2, cols=1),
425+
db, subtask=yokogawa, args=dict(parallelization_level="well")
411426
)
412427
debug(TaskRead.from_orm(wf))
413428

@@ -435,7 +450,7 @@ async def test_yokogawa(
435450
import dask.array as da
436451

437452
data_czyx = da.from_zarr(zarrurl)
438-
assert data_czyx.shape == (1, 2, 2160 * 2, 2560)
453+
assert data_czyx.shape == (1, 2, 2160, 2 * 2560)
439454
assert data_czyx[0, 0, 0, 0].compute() == 0
440455
except ImportError:
441456
pass

tests/test_full_workflow.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,17 @@ async def test_project_creation(
128128
# add subtasks
129129
res = await client.post(
130130
f"{PREFIX}/task/{workflow_id}/subtask/",
131-
json=dict(subtask_id=task_id_create_zarr),
131+
json=dict(
132+
subtask_id=task_id_create_zarr,
133+
args=dict(channel_parameters={"A01_C01": {}}),
134+
),
132135
)
133136
assert res.status_code == 201
134137
res = await client.post(
135138
f"{PREFIX}/task/{workflow_id}/subtask/",
136139
json=dict(
137140
subtask_id=task_id_yokogawa,
138-
args=dict(parallelization_level="well", rows=2, cols=1),
141+
args=dict(parallelization_level="well"),
139142
),
140143
)
141144
assert res.status_code == 201
@@ -176,8 +179,9 @@ async def test_project_creation(
176179
debug(zarrurl)
177180
try:
178181
import dask.array as da
182+
179183
data_czyx = da.from_zarr(zarrurl)
180-
assert data_czyx.shape == (1, 2, 2160 * 2, 2560)
184+
assert data_czyx.shape == (1, 2, 2160, 2 * 2560)
181185
assert data_czyx[0, 0, 0, 0].compute() == 0
182186
except ImportError:
183187
pass

0 commit comments

Comments
 (0)