@@ -834,3 +834,37 @@ def test_lib_upgrade_using_library_with_invalid_version(run_command, data_dir):
834834 data = json .loads (res .stdout )
835835 assert len (data ) == 1
836836 assert "" != data [0 ]["library" ]["version" ]
837+
838+
839+ def test_install_zip_lib_with_macos_metadata (run_command , data_dir , downloads_dir ):
840+ # Initialize configs to enable --zip-path flag
841+ env = {
842+ "ARDUINO_DATA_DIR" : data_dir ,
843+ "ARDUINO_DOWNLOADS_DIR" : downloads_dir ,
844+ "ARDUINO_SKETCHBOOK_DIR" : data_dir ,
845+ "ARDUINO_ENABLE_UNSAFE_LIBRARY_INSTALL" : "true" ,
846+ }
847+ assert run_command ("config init --dest-dir ." , custom_env = env )
848+
849+ lib_install_dir = Path (data_dir , "libraries" , "fake-lib" )
850+ # Verifies library is not already installed
851+ assert not lib_install_dir .exists ()
852+
853+ zip_path = Path (__file__ ).parent / "testdata" / "fake-lib.zip"
854+ # Test zip-path install
855+ res = run_command (f"lib install --zip-path { zip_path } " )
856+ assert res .ok
857+ assert "--git-url and --zip-path flags allow installing untrusted files, use it at your own risk." in res .stdout
858+
859+ # Verifies library is installed in expected path
860+ assert lib_install_dir .exists ()
861+ files = list (lib_install_dir .glob ("**/*" ))
862+ assert lib_install_dir / "library.properties" in files
863+
864+ # Reinstall library
865+ assert run_command (f"lib install --zip-path { zip_path } " )
866+
867+ # Verifies library remains installed
868+ assert lib_install_dir .exists ()
869+ files = list (lib_install_dir .glob ("**/*" ))
870+ assert lib_install_dir / "library.properties" in files
0 commit comments