@@ -689,6 +689,41 @@ def test_core_list_platform_without_platform_txt(run_command, data_dir):
689689 assert core ["name" ] == "some-packager-some-arch"
690690
691691
692+ def test_core_download_multiple_platforms (run_command , data_dir ):
693+ assert run_command (["update" ])
694+
695+ # Verifies no core is installed
696+ res = run_command (["core" , "list" , "--format" , "json" ])
697+ assert res .ok
698+ cores = json .loads (res .stdout )
699+ assert len (cores ) == 0
700+
701+ # Simulates creation of two new cores in the sketchbook hardware folder
702+ test_boards_txt = Path (__file__ ).parent / "testdata" / "boards.local.txt"
703+ boards_txt = Path (data_dir , "packages" , "PACKAGER" , "hardware" , "ARCH" , "1.0.0" , "boards.txt" )
704+ boards_txt .parent .mkdir (parents = True , exist_ok = True )
705+ boards_txt .touch ()
706+ assert boards_txt .write_bytes (test_boards_txt .read_bytes ())
707+
708+ test_boards_txt = Path (__file__ ).parent / "testdata" / "boards.local.txt"
709+ boards_txt = Path (data_dir , "packages" , "packager" , "hardware" , "arch" , "1.0.0" , "boards.txt" )
710+ boards_txt .parent .mkdir (parents = True , exist_ok = True )
711+ boards_txt .touch ()
712+ assert boards_txt .write_bytes (test_boards_txt .read_bytes ())
713+
714+ # Verifies the two cores are detected
715+ res = run_command (["core" , "list" , "--format" , "json" ])
716+ assert res .ok
717+ cores = json .loads (res .stdout )
718+ assert len (cores ) == 2
719+
720+ # Try to do an operation on the fake cores.
721+ # The cli should not allow it since optimizing the casing results in finding two cores
722+ res = run_command (["core" , "upgrade" , "Packager:Arch" ])
723+ assert res .failed
724+ assert "Invalid argument passed: Found 2 platform for reference" in res .stderr
725+
726+
692727def test_core_with_wrong_custom_board_options_is_loaded (run_command , data_dir ):
693728 test_platform_name = "platform_with_wrong_custom_board_options"
694729 platform_install_dir = Path (data_dir , "hardware" , "arduino-beta-dev" , test_platform_name )
0 commit comments