@@ -1091,6 +1091,42 @@ def get_value(*args, **kwargs):
10911091 "JOB_WALLCLOCK_TIME" , "12:00:00" , subgroup = "case.run"
10921092 )
10931093
1094+ @mock .patch ("CIME.XML.env_batch.get_batch_script_for_job" )
1095+ @mock .patch ("CIME.XML.env_batch.get_cime_config" )
1096+ def test_submit_single_job_mail_type_comma_separated (
1097+ self , get_cime_config , get_batch_script_for_job
1098+ ):
1099+ """Test that multiple mail types are joined with commas, not repeated flags."""
1100+ with ExitStack () as stack :
1101+ file1 = _open_temp_file (stack , XML_BASE )
1102+ batch = EnvBatch (infile = file1 .name )
1103+
1104+ case = mock .MagicMock ()
1105+ case .get_value .side_effect = lambda * args , ** kwargs : {
1106+ "BATCH_COMMAND_FLAGS" : "" ,
1107+ "PROJECT" : "test_project" ,
1108+ }.get (args [0 ], None )
1109+ case .get_resolved_value .side_effect = lambda x , ** kwargs : x
1110+
1111+ cime_config = mock .MagicMock ()
1112+ cime_config .has_option .return_value = False
1113+ get_cime_config .return_value = cime_config
1114+
1115+ get_batch_script_for_job .return_value = "case.run"
1116+ batch ._env_workflow = mock .MagicMock ()
1117+ batch ._env_workflow .hidden_job .return_value = False
1118+
1119+ with mock .patch .object (batch , "_build_run_args_str" , return_value = "" ):
1120+ submitcmd = batch ._submit_single_job (
1121+ case ,
1122+ "case.run" ,
1123+ mail_type = ["end" , "fail" ],
1124+ dry_run = True ,
1125+ )
1126+
1127+ assert "--mail-type end,fail" in submitcmd
1128+ assert "--mail-type end --mail-type fail" not in submitcmd
1129+
10941130 def test_get_job_overrides_mpi_serial_single_task (self ):
10951131 """Test that get_job_overrides gives expected results for an mpi-serial case with a single task"""
10961132 task_count = 1
0 commit comments