From 09c0988369826d9afcae0cdf4a75371f3164147c Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Tue, 28 May 2024 14:49:43 +0100 Subject: [PATCH] fix test producing unwanted traceback --- tests/integration/test_platforms.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/integration/test_platforms.py b/tests/integration/test_platforms.py index 7bc21476333..d88d6ad1646 100644 --- a/tests/integration/test_platforms.py +++ b/tests/integration/test_platforms.py @@ -16,9 +16,14 @@ """Integration testing for platforms functionality. """ +from contextlib import suppress + +from cylc.flow.exceptions import NoPlatformsError +from cylc.flow.task_job_logs import get_task_job_activity_log + async def test_prep_submit_task_tries_multiple_platforms( - flow, scheduler, run, mock_glbl_cfg, monkeypatch + flow, scheduler, run, mock_glbl_cfg, monkeypatch, tmp_path ): """Preparation tries multiple platforms within a group if the task platform setting matches a group, and that after all platforms @@ -43,9 +48,8 @@ async def test_prep_submit_task_tries_multiple_platforms( schd = scheduler(wid, paused_start=False, run_mode='live') async with run(schd): itask = schd.pool.get_tasks()[0] - # Avoid breaking on trying to create log file path: - schd.task_job_mgr._create_job_log_path = lambda *_: None + itask.submit_num = 1 schd.task_job_mgr.bad_hosts = {'broken', 'broken2'} res = schd.task_job_mgr._prep_submit_task_job(schd.workflow, itask) - assert res is True + assert isinstance(res, NoPlatformsError) assert not schd.task_job_mgr.bad_hosts