@@ -777,3 +777,38 @@ def test_core_list_outdated_core(run_command):
777
777
latest_version = semver .parse_version_info (samd_core ["latest" ])
778
778
# Installed version must be older than latest
779
779
assert installed_version .compare (latest_version ) == - 1
780
+
781
+
782
+ def test_core_loading_package_manager (run_command ):
783
+ assert run_command (["update" ])
784
+
785
+ # Install core
786
+ url = "https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json" # noqa: E501
787
+ assert run_command (["core" , "update-index" , f"--additional-urls={ url } " ])
788
+ assert run_command ([
"core" ,
"install" ,
"attiny:[email protected] " ,
f"--additional-urls={ url } " ])
789
+
790
+ # Verifies installed core is correctly found and name is set
791
+ res = run_command (["core" , "list" , "--format" , "json" ])
792
+ assert res .ok
793
+ cores = json .loads (res .stdout )
794
+ mapped = {core ["id" ]: core for core in cores }
795
+ assert len (mapped ) == 1
796
+ assert "attiny:avr" in mapped
797
+ assert mapped ["attiny:avr" ]["name" ] == "attiny"
798
+
799
+ # Uninstall the core: this should leave some residue:
800
+ # tree ~/.arduino15/packages/
801
+ # /home/umberto/.arduino15/packages/
802
+ # ├── attiny
803
+ # │ └── hardware
804
+ # │ └── avr
805
+ #
806
+ # Please note that the folder avr is empty
807
+
808
+ assert run_command (["core" , "uninstall" , "attiny:avr" ])
809
+ result = run_command (["core" , "list" , "--format" , "json" ])
810
+ assert result .ok
811
+ assert not _in (result .stdout , "attiny:avr" )
812
+
813
+ result = run_command (["core" , "list" , "--all" , "--format" , "json" ])
814
+ assert result .ok # this should not make the cli crash
0 commit comments