Skip to content

Commit bcdb302

Browse files
Migrate TestInstallWithGitLocalUrl from test_lib.py to lib_test.go
1 parent 7d02934 commit bcdb302

File tree

2 files changed

+29
-25
lines changed

2 files changed

+29
-25
lines changed

internal/integrationtest/lib/lib_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,3 +868,32 @@ func TestInstallWithGitUrlFromCurrentDirectory(t *testing.T) {
868868
// Verifies library is installed to correct folder
869869
require.DirExists(t, libInstallDir.String())
870870
}
871+
872+
func TestInstallWithGitLocalUrl(t *testing.T) {
873+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
874+
defer env.CleanUp()
875+
876+
_, _, err := cli.Run("update")
877+
require.NoError(t, err)
878+
879+
envVar := cli.GetDefaultEnv()
880+
envVar["ARDUINO_ENABLE_UNSAFE_LIBRARY_INSTALL"] = "true"
881+
882+
libInstallDir := cli.SketchbookDir().Join("libraries", "WiFi101")
883+
// Verifies library is not installed
884+
require.NoDirExists(t, libInstallDir.String())
885+
886+
// Clone repository locally
887+
gitUrl := "https://github.com/arduino-libraries/WiFi101.git"
888+
repoDir := cli.SketchbookDir().Join("WiFi101")
889+
_, err = git.PlainClone(repoDir.String(), false, &git.CloneOptions{
890+
URL: gitUrl,
891+
})
892+
require.NoError(t, err)
893+
894+
_, _, err = cli.RunWithCustomEnv(envVar, "lib", "install", "--git-url", repoDir.String())
895+
require.NoError(t, err)
896+
897+
// Verifies library is installed
898+
require.DirExists(t, libInstallDir.String())
899+
}

test/test_lib.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -176,31 +176,6 @@ def test_install_with_git_url_local_file_uri(run_command, downloads_dir, data_di
176176
assert lib_install_dir.exists()
177177

178178

179-
def test_install_with_git_local_url(run_command, downloads_dir, data_dir):
180-
assert run_command(["update"])
181-
182-
env = {
183-
"ARDUINO_DATA_DIR": data_dir,
184-
"ARDUINO_DOWNLOADS_DIR": downloads_dir,
185-
"ARDUINO_SKETCHBOOK_DIR": data_dir,
186-
"ARDUINO_ENABLE_UNSAFE_LIBRARY_INSTALL": "true",
187-
}
188-
189-
lib_install_dir = Path(data_dir, "libraries", "WiFi101")
190-
# Verifies library is not installed
191-
assert not lib_install_dir.exists()
192-
193-
# Clone repository locally
194-
git_url = "https://github.com/arduino-libraries/WiFi101.git"
195-
repo_dir = Path(data_dir, "WiFi101")
196-
assert Repo.clone_from(git_url, repo_dir)
197-
198-
assert run_command(["lib", "install", "--git-url", repo_dir], custom_env=env)
199-
200-
# Verifies library is installed
201-
assert lib_install_dir.exists()
202-
203-
204179
def test_install_with_git_url_relative_path(run_command, downloads_dir, data_dir):
205180
assert run_command(["update"])
206181

0 commit comments

Comments
 (0)