@@ -342,17 +342,28 @@ def test_untracked_files_raises_exception(temp_repo):
342342@patch ("nemo_run.core.packaging.git.Context" , MockContext )
343343def test_package_with_include_submodules (packager , temp_repo ):
344344 temp_repo = Path (temp_repo )
345- # Create a submodule
345+ # Create first submodule
346346 submodule_path = temp_repo / "submodule"
347347 submodule_path .mkdir ()
348348 os .chdir (str (submodule_path ))
349349 subprocess .check_call (["git" , "init" , "--initial-branch=main" ])
350350 open ("submodule_file.txt" , "w" ).write ("Submodule file" )
351351 subprocess .check_call (["git" , "add" , "." ])
352352 subprocess .check_call (["git" , "commit" , "-m" , "Initial submodule commit" ])
353+
354+ # Create second submodule
355+ submodule2_path = temp_repo / "submodule2"
356+ submodule2_path .mkdir ()
357+ os .chdir (str (submodule2_path ))
358+ subprocess .check_call (["git" , "init" , "--initial-branch=main" ])
359+ open ("submodule2_file.txt" , "w" ).write ("Second submodule file" )
360+ subprocess .check_call (["git" , "add" , "." ])
361+ subprocess .check_call (["git" , "commit" , "-m" , "Initial submodule2 commit" ])
362+
353363 os .chdir (str (temp_repo ))
354364 subprocess .check_call (["git" , "submodule" , "add" , str (submodule_path )])
355- subprocess .check_call (["git" , "commit" , "-m" , "Add submodule" ])
365+ subprocess .check_call (["git" , "submodule" , "add" , str (submodule2_path )])
366+ subprocess .check_call (["git" , "commit" , "-m" , "Add submodules" ])
356367
357368 packager = GitArchivePackager (ref = "HEAD" , include_submodules = True )
358369 with tempfile .TemporaryDirectory () as job_dir :
@@ -364,13 +375,22 @@ def test_package_with_include_submodules(packager, temp_repo):
364375 f"tar -xvzf { output_file } -C { os .path .join (job_dir , 'extracted_output' )} --ignore-zeros"
365376 ),
366377 )
378+ # Check first submodule
367379 cmp = filecmp .dircmp (
368380 os .path .join (temp_repo , "submodule" ),
369381 os .path .join (job_dir , "extracted_output" , "submodule" ),
370382 )
371383 assert cmp .left_list == cmp .right_list
372384 assert not cmp .diff_files
373385
386+ # Check second submodule
387+ cmp2 = filecmp .dircmp (
388+ os .path .join (temp_repo , "submodule2" ),
389+ os .path .join (job_dir , "extracted_output" , "submodule2" ),
390+ )
391+ assert cmp2 .left_list == cmp2 .right_list
392+ assert not cmp2 .diff_files
393+
374394
375395@patch ("nemo_run.core.packaging.git.Context" , MockContext )
376396def test_package_without_include_submodules (packager , temp_repo ):
0 commit comments