From 95d7a87c354828f00fe4f7a5b473b4a3c3b3821c Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Thu, 4 Jan 2024 09:09:29 +0000 Subject: [PATCH] Prevent false positives in test for broadcast. Test broadcast using _prep_submit_task_job rather than _prep_submit_task_job_impl so that the fake broadcast is applied. --- tests/integration/test_task_job_mgr.py | 28 +++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/tests/integration/test_task_job_mgr.py b/tests/integration/test_task_job_mgr.py index 5bfdf856a8f..b085162a1da 100644 --- a/tests/integration/test_task_job_mgr.py +++ b/tests/integration/test_task_job_mgr.py @@ -166,19 +166,23 @@ async def test__prep_submit_task_job_impl_handles_execution_time_limit( with suppress(FileExistsError): schd.task_job_mgr._prep_submit_task_job_impl( schd.workflow, task_a, task_a.tdef.rtconfig) - assert task_a.summary['execution_time_limit'] == 5.0 + assert task_a.summary['execution_time_limit'] == 5.0 - # If we delete the etl it gets deleted in the summary: - task_a.tdef.rtconfig['execution time limit'] = None + # If we delete the etl it gets deleted in the summary: + task_a.tdef.rtconfig['execution time limit'] = None + with suppress(FileExistsError): schd.task_job_mgr._prep_submit_task_job_impl( schd.workflow, task_a, task_a.tdef.rtconfig) - assert not task_a.summary.get('execution_time_limit', '') + assert not task_a.summary.get('execution_time_limit', '') - # put everything back and test broadcast too. - task_a.tdef.rtconfig['execution time limit'] = 5.0 - task_a.summary['execution_time_limit'] = 5.0 - schd.broadcast_mgr.broadcasts = { - '1': {'a': {'execution time limit': None}}} - schd.task_job_mgr._prep_submit_task_job_impl( - schd.workflow, task_a, task_a.tdef.rtconfig) - assert not task_a.summary.get('execution_time_limit', '') + # put everything back and test broadcast too. + task_a.tdef.rtconfig['execution time limit'] = 5.0 + task_a.summary['execution_time_limit'] = 5.0 + schd.broadcast_mgr.broadcasts = { + '1': {'a': {'execution time limit': None}}} + with suppress(FileExistsError): + # We run a higher level function here to ensure + # that the broadcast is applied. + schd.task_job_mgr._prep_submit_task_job( + schd.workflow, task_a) + assert not task_a.summary.get('execution_time_limit', '')