Skip to content

Commit

Permalink
chore: change mock to use a more specified `orchestrator.get_orchestr…
Browse files Browse the repository at this point in the history
…ator_client`

Signed-off-by: Guilhem Barthés <guilhem.barthes@owkin.com>
  • Loading branch information
guilhem-barthes committed May 27, 2024
1 parent b603996 commit 49bb096
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions backend/builder/tests/test_task_build_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_order_building_success(celery_app, celery_worker, mocker, execution_num
function_2 = orc_mock.FunctionFactory()

# BuildTask `before_start` uses this client to change the status, which would lead to `OrcError`
mocker.patch("orchestrator.get_orchestrator_client")
mocker.patch("builder.tasks.task.orchestrator.get_orchestrator_client")
mocker.patch("builder.tasks.tasks_build_image.build_image_if_missing", side_effect=lambda x, y: time.sleep(0.5))

result_1 = build_image.apply_async(
Expand Down Expand Up @@ -70,7 +70,7 @@ def side_effect(*args, **kwargs):
return side_effect

# BuildTask `before_start` uses this client to change the status, which would lead to `OrcError`
mocker.patch("orchestrator.get_orchestrator_client")
mocker.patch("builder.tasks.task.orchestrator.get_orchestrator_client")
mocker.patch("builder.tasks.tasks_build_image.build_image_if_missing", side_effect=side_effect_creator())

result_retry = build_image.apply_async(
Expand Down
2 changes: 1 addition & 1 deletion backend/substrapp/tests/compute_tasks/test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_save_model(settings, mocker: MockerFixture, orc_raise: bool):
client.register_models.return_value = []

add_model_from_path = mocker.patch("substrapp.compute_tasks.outputs.add_model_from_path")
mocker.patch("orchestrator.get_orchestrator_client", return_value=client)
mocker.patch("substrapp.compute_tasks.outputs.orchestrator.get_orchestrator_client", return_value=client)
organization_client_post = mocker.patch("substrapp.compute_tasks.outputs.organization_client.post")

try:
Expand Down
4 changes: 2 additions & 2 deletions backend/substrapp/tests/tasks/test_compute_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


def test_compute_task_exception(mocker: MockerFixture):
mocker.patch("orchestrator.get_orchestrator_client")
mocker.patch("substrapp.tasks.tasks_compute_task.orchestrator.get_orchestrator_client")
mock_raise_if_not_runnable = mocker.patch("substrapp.compute_tasks.compute_task._raise_if_task_not_runnable")
mock_start_task = mocker.patch("substrapp.compute_tasks.compute_task.start_task_if_not_started")
mock_init_cp_dirs = mocker.patch("substrapp.tasks.tasks_compute_task.init_compute_plan_dirs")
Expand Down Expand Up @@ -123,7 +123,7 @@ def decorated_function(*args, **kwargs):


def test_celery_retry(mocker: MockerFixture):
mocker.patch("orchestrator.get_orchestrator_client")
mocker.patch("substrapp.tasks.tasks_compute_task.orchestrator.get_orchestrator_client")
mocker.patch("substrapp.compute_tasks.compute_task._raise_if_task_not_runnable")
mocker.patch("substrapp.compute_tasks.compute_task.start_task_if_not_started")
mocker.patch("substrapp.tasks.tasks_compute_task.Context.from_task")
Expand Down

0 comments on commit 49bb096

Please sign in to comment.