@@ -195,6 +195,49 @@ def test_alt_template_with_condition(runner, paths, tst_arch):
195195 assert len (created ) == 0
196196
197197
198+ @pytest .mark .usefixtures ("ds1_copy" )
199+ @pytest .mark .parametrize ("kind" , ["default" , None , "envtpl" , "j2" , "esh" ])
200+ @pytest .mark .parametrize (
201+ "label" ,
202+ [
203+ "s" ,
204+ "seed" ,
205+ ],
206+ )
207+ def test_alt_seed (runner , paths , kind , label ):
208+ """Test template seed"""
209+ yadm_dir , yadm_data = setup_standard_yadm_dir (paths )
210+
211+ suffix = f"##{ label } .{ kind } "
212+ if kind is None :
213+ suffix = f"##{ label } "
214+
215+ utils .create_alt_files (paths , suffix , content = "first" )
216+ run = runner ([paths .pgm , "-Y" , yadm_dir , "--yadm-data" , yadm_data , "alt" ])
217+ assert run .success
218+ assert run .err == ""
219+
220+ utils .create_alt_files (paths , suffix , preserve = True , content = "second" )
221+ run2 = runner ([paths .pgm , "-Y" , yadm_dir , "--yadm-data" , yadm_data , "alt" ])
222+ assert run2 .success
223+ assert run2 .err == ""
224+
225+ created = utils .parse_alt_output (run .out , linked = False )
226+ created2 = utils .parse_alt_output (run2 .out , linked = False )
227+ assert len (created2 ) == 0
228+
229+ for created_path in TEST_PATHS :
230+ source_file_content = created_path + suffix
231+ source_file = paths .work .join (source_file_content )
232+ created_file = paths .work .join (created_path )
233+ if created_path == utils .ALT_DIR :
234+ source_file = source_file .join (utils .CONTAINED )
235+ created_file = created_file .join (utils .CONTAINED )
236+ assert created_file .isfile ()
237+ assert created_file .read ().strip () == source_file_content + "\n first"
238+ assert str (source_file ) in created
239+
240+
198241@pytest .mark .usefixtures ("ds1_copy" )
199242@pytest .mark .parametrize ("autoalt" , [None , "true" , "false" ])
200243def test_auto_alt (runner , yadm_cmd , paths , autoalt ):
0 commit comments