Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e4cef88

Browse files
committedNov 9, 2022
Migrate TestCoreUpdateWithLocalUrl from test_core.py to core_test.go
1 parent 7cd3ee5 commit e4cef88

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed
 

‎internal/integrationtest/core/core_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package core_test
1717

1818
import (
1919
"fmt"
20+
"runtime"
2021
"strings"
2122
"testing"
2223

@@ -370,3 +371,18 @@ func TestCoreBrokenInstall(t *testing.T) {
370371
_, _, err = cli.Run("core", "install", "brokenchecksum:x86", "--additional-urls="+url)
371372
require.Error(t, err)
372373
}
374+
375+
func TestCoreUpdateWithLocalUrl(t *testing.T) {
376+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
377+
defer env.CleanUp()
378+
379+
wd, _ := paths.Getwd()
380+
testIndex := wd.Parent().Join("testdata", "test_index.json").String()
381+
if runtime.GOOS == "windows" {
382+
testIndex = "/" + strings.ReplaceAll(testIndex, "\\", "/")
383+
}
384+
385+
stdout, _, err := cli.Run("core", "update-index", "--additional-urls=file://"+testIndex)
386+
require.NoError(t, err)
387+
require.Contains(t, string(stdout), "Downloading index: test_index.json downloaded")
388+
}

‎test/test_core.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,6 @@ def ordered(obj):
6868
assert ordered(installed_json) == ordered(expected_installed_json)
6969

7070

71-
def test_core_update_with_local_url(run_command):
72-
test_index = str(Path(__file__).parent / "testdata" / "test_index.json")
73-
if platform.system() == "Windows":
74-
test_index = f"/{test_index}".replace("\\", "/")
75-
76-
res = run_command(["core", "update-index", f'--additional-urls="file://{test_index}"'])
77-
assert res.ok
78-
assert "Downloading index: test_index.json downloaded" in res.stdout
79-
80-
8171
def test_core_search_manually_installed_cores_not_printed(run_command, data_dir):
8272
assert run_command(["core", "update-index"])
8373

0 commit comments

Comments
 (0)
Please sign in to comment.