Skip to content

Fix lib install with git url #1143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 20, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add test
  • Loading branch information
silvanocerza committed Jan 20, 2021
commit 7df7d0d086bf7960fb99a512448f9286adebd408
26 changes: 24 additions & 2 deletions test/test_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ def test_install_with_git_url_local_file_uri(run_command, downloads_dir, data_di
repo_dir = Path(data_dir, "WiFi101")
assert Repo.clone_from(git_url, repo_dir)

assert run_command(f"lib install --git-url {repo_dir.as_uri()}", custom_working_dir=repo_dir, custom_env=env)
assert run_command(f"lib install --git-url {repo_dir.as_uri()}", custom_env=env)


def test_install_with_git_local_url(run_command, downloads_dir, data_dir):
Expand All @@ -460,4 +460,26 @@ def test_install_with_git_local_url(run_command, downloads_dir, data_dir):
repo_dir = Path(data_dir, "WiFi101")
assert Repo.clone_from(git_url, repo_dir)

assert run_command(f"lib install --git-url {repo_dir}", custom_working_dir=repo_dir, custom_env=env)
assert run_command(f"lib install --git-url {repo_dir}", custom_env=env)


def test_install_with_git_url_relative_path(run_command, downloads_dir, data_dir):
assert run_command("update")

env = {
"ARDUINO_DATA_DIR": data_dir,
"ARDUINO_DOWNLOADS_DIR": downloads_dir,
"ARDUINO_SKETCHBOOK_DIR": data_dir,
"ARDUINO_ENABLE_UNSAFE_LIBRARY_INSTALL": "true",
}

lib_install_dir = Path(data_dir, "libraries", "WiFi101")
# Verifies library is not installed
assert not lib_install_dir.exists()

# Clone repository locally
git_url = "https://github.com/arduino-libraries/WiFi101.git"
repo_dir = Path(data_dir, "WiFi101")
assert Repo.clone_from(git_url, repo_dir)

assert run_command("lib install --git-url ./WiFi101", custom_working_dir=data_dir, custom_env=env)