From e40f515aaf3c25876421c49730f991dc8ec53b50 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Apr 2026 18:31:59 +0000 Subject: [PATCH 1/3] Initial plan From 40f1f8540ebedce8c743b45ff6ce2793186a81a1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Apr 2026 18:37:22 +0000 Subject: [PATCH 2/3] Fix mail-type args to use comma-separated values instead of repeated flags Agent-Logs-Url: https://github.com/ESMCI/cime/sessions/3844aabe-19bc-468e-a9c0-5dbf29bcde11 Co-authored-by: jgfouca <7292036+jgfouca@users.noreply.github.com> --- CIME/XML/env_batch.py | 2 +- CIME/tests/test_unit_xml_env_batch.py | 38 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/CIME/XML/env_batch.py b/CIME/XML/env_batch.py index f37006225e6..fbcc112c56f 100644 --- a/CIME/XML/env_batch.py +++ b/CIME/XML/env_batch.py @@ -1119,7 +1119,7 @@ def _submit_single_job( else: submitargs += " {} {}".format( mail_type_flag, - " {} ".format(mail_type_flag).join(mail_type_args), + ",".join(mail_type_args), ) batchsubmit = self.get_value("batch_submit", subgroup=None) expect( diff --git a/CIME/tests/test_unit_xml_env_batch.py b/CIME/tests/test_unit_xml_env_batch.py index 26021b9e20d..32d748aa863 100755 --- a/CIME/tests/test_unit_xml_env_batch.py +++ b/CIME/tests/test_unit_xml_env_batch.py @@ -1091,6 +1091,44 @@ def get_value(*args, **kwargs): "JOB_WALLCLOCK_TIME", "12:00:00", subgroup="case.run" ) + @mock.patch("CIME.XML.env_batch.get_batch_script_for_job") + @mock.patch("CIME.XML.env_batch.get_cime_config") + def test_submit_single_job_mail_type_comma_separated( + self, get_cime_config, get_batch_script_for_job + ): + """Test that multiple mail types are joined with commas, not repeated flags.""" + with ExitStack() as stack: + file1 = _open_temp_file(stack, XML_BASE) + batch = EnvBatch(infile=file1.name) + + case = mock.MagicMock() + case.get_value.side_effect = lambda *args, **kwargs: { + "BATCH_COMMAND_FLAGS": "", + "PROJECT": "test_project", + }.get(args[0], None) + case.get_resolved_value.side_effect = lambda x, **kwargs: x + + cime_config = mock.MagicMock() + cime_config.has_option.return_value = False + get_cime_config.return_value = cime_config + + get_batch_script_for_job.return_value = "case.run" + batch._env_workflow = mock.MagicMock() + batch._env_workflow.hidden_job.return_value = False + + with mock.patch.object( + batch, "_build_run_args_str", return_value="" + ): + submitcmd = batch._submit_single_job( + case, + "case.run", + mail_type=["end", "fail"], + dry_run=True, + ) + + assert "--mail-type end,fail" in submitcmd + assert "--mail-type end --mail-type fail" not in submitcmd + def test_get_job_overrides_mpi_serial_single_task(self): """Test that get_job_overrides gives expected results for an mpi-serial case with a single task""" task_count = 1 From d5706531d64bcf53883a6b232ccf1c7e3c80c221 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Wed, 22 Apr 2026 12:03:58 -0700 Subject: [PATCH 3/3] black --- CIME/tests/test_unit_xml_env_batch.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CIME/tests/test_unit_xml_env_batch.py b/CIME/tests/test_unit_xml_env_batch.py index 32d748aa863..3599cfe1dfc 100755 --- a/CIME/tests/test_unit_xml_env_batch.py +++ b/CIME/tests/test_unit_xml_env_batch.py @@ -1116,9 +1116,7 @@ def test_submit_single_job_mail_type_comma_separated( batch._env_workflow = mock.MagicMock() batch._env_workflow.hidden_job.return_value = False - with mock.patch.object( - batch, "_build_run_args_str", return_value="" - ): + with mock.patch.object(batch, "_build_run_args_str", return_value=""): submitcmd = batch._submit_single_job( case, "case.run",