@@ -88,8 +88,8 @@ def test_copying_experiment_with_hpc_in_command(autosubmit_exp: Callable, autosu
8888 assert yaml_data ['MAIL' ]['TO' ] == ""
8989 assert yaml_data ['JOBS' ]['LOCAL_SEND_INITIAL' ]['CHUNKS_FROM' ]['1' ]['CHUNKS_TO' ] == '1'
9090 assert yaml_data ['LOCAL' ]['PROJECT_PATH' ] == ""
91- assert yaml_data ['GIT' ]['PROJECT_ORIGIN' ] == ""
92- assert yaml_data ['GIT' ]['PROJECT_BRANCH' ] == ""
91+ assert yaml_data ['GIT' ]['PROJECT_ORIGIN' ] == "origin_test "
92+ assert yaml_data ['GIT' ]['PROJECT_BRANCH' ] == "branch_test "
9393
9494
9595def test_copying_experiment_without_hpc_in_command (autosubmit_exp : Callable , autosubmit : Autosubmit , tmp_path ):
@@ -190,8 +190,20 @@ def test_copying_experiment_with_hpc_in_file(autosubmit_exp: Callable, autosubmi
190190 yaml_data = yaml .load (open (tmp_path / f"{ exp_id } /conf/metadata/experiment_data.yml" ))
191191 assert yaml_data ['DEFAULT' ]['HPCARCH' ] == "MN5"
192192
193-
194- def test_as_conf_default_values (autosubmit_exp : Callable , autosubmit : Autosubmit , tmp_path ):
193+ @pytest .mark .parametrize (
194+ 'git_command,git_session' ,
195+ [
196+ (['' , '' ], ['' , '' ]),
197+ (['test_1' , 'test_2' ], ['' , '' ]),
198+ (['' , 'test_2' ], ['' , '' ]),
199+ (['test_1' , '' ], ['' , '' ]),
200+ (['' , '' ], ['test_3' , 'test_4' ]),
201+ (['test_1' , 'test_2' ], ['test_3' , 'test_4' ]),
202+ (['' , 'test_2' ], ['test_3' , 'test_4' ]),
203+ (['test_1' , '' ], ['test_3' , 'test_4' ]),
204+ ],
205+ )
206+ def test_as_conf_default_values (git_command , git_session , autosubmit_exp : Callable , autosubmit : Autosubmit , tmp_path ):
195207 """Test that the ``check_jobs_file_exists`` function ignores a non-existent section."""
196208 exp = autosubmit_exp (experiment_data = {
197209 'JOBS' : {
@@ -203,8 +215,12 @@ def test_as_conf_default_values(autosubmit_exp: Callable, autosubmit: Autosubmit
203215 }
204216 }
205217 },
218+ 'GIT' : {
219+ 'PROJECT_ORIGIN' : f'{ git_session [0 ]} ' ,
220+ 'PROJECT_BRANCH' : f'{ git_session [1 ]} '
221+ },
206222 })
207- as_conf_default_values (autosubmit .autosubmit_version , exp .expid , 'MN5' , True , 'test_1' , 'test_2' , 'test_3' )
223+ as_conf_default_values (autosubmit .autosubmit_version , exp .expid , 'MN5' , True , git_command [ 0 ], git_command [ 1 ] , 'test_3' )
208224
209225 yaml = YAML (typ = 'rt' )
210226 assert autosubmit .create (exp .expid , noplot = True , hide = True ) == 0
@@ -213,8 +229,26 @@ def test_as_conf_default_values(autosubmit_exp: Callable, autosubmit: Autosubmit
213229 assert yaml_data ['DEFAULT' ]['EXPID' ] == exp .expid
214230 assert yaml_data ['DEFAULT' ]['CUSTOM_CONFIG' ] == f'"{ tmp_path } /{ exp .expid } /proj/test_3"'
215231 assert yaml_data ['LOCAL' ]['PROJECT_PATH' ] == ""
216- assert yaml_data ['GIT' ]['PROJECT_ORIGIN' ] == "test_1"
217- assert yaml_data ['GIT' ]['PROJECT_BRANCH' ] == "test_2"
232+
233+ if git_command [0 ] != '' :
234+ assert yaml_data ['GIT' ]['PROJECT_ORIGIN' ] == git_command [0 ]
235+ else :
236+ assert yaml_data ['GIT' ]['PROJECT_ORIGIN' ] == git_session [0 ]
237+
238+ if git_command [1 ] != '' :
239+ assert yaml_data ['GIT' ]['PROJECT_BRANCH' ] == git_command [1 ]
240+ else :
241+ assert yaml_data ['GIT' ]['PROJECT_BRANCH' ] == git_session [1 ]
242+
243+ if git_session [0 ] != '' and git_command [0 ] == '' :
244+ assert yaml_data ['GIT' ]['PROJECT_ORIGIN' ] == git_session [0 ]
245+ else :
246+ assert yaml_data ['GIT' ]['PROJECT_ORIGIN' ] == git_command [0 ]
247+
248+ if git_session [1 ] != '' and git_command [1 ] == '' :
249+ assert yaml_data ['GIT' ]['PROJECT_BRANCH' ] == git_session [1 ]
250+ else :
251+ assert yaml_data ['GIT' ]['PROJECT_BRANCH' ] == git_command [1 ]
218252
219253
220254@pytest .mark .parametrize (
0 commit comments