Skip to content

Commit f0bc229

Browse files
Migrate TestCoreDownload from test_core.py to core_test.go
1 parent c1c4e96 commit f0bc229

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

internal/integrationtest/core/core_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,29 @@ func TestCoreInstallWithoutUpdateIndex(t *testing.T) {
230230
require.NoError(t, err)
231231
require.Contains(t, string(stdout), "Downloading index: package_index.tar.bz2 downloaded")
232232
}
233+
234+
func TestCoreDownload(t *testing.T) {
235+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
236+
defer env.CleanUp()
237+
238+
_, _, err := cli.Run("core", "update-index")
239+
require.NoError(t, err)
240+
241+
// Download a specific core version
242+
_, _, err = cli.Run("core", "download", "arduino:avr@1.6.16")
243+
require.NoError(t, err)
244+
require.FileExists(t, cli.DownloadDir().Join("packages", "avr-1.6.16.tar.bz2").String())
245+
246+
// Wrong core version
247+
_, _, err = cli.Run("core", "download", "arduino:avr@69.42.0")
248+
require.Error(t, err)
249+
250+
// Wrong core
251+
_, _, err = cli.Run("core", "download", "bananas:avr")
252+
require.Error(t, err)
253+
254+
// Wrong casing
255+
_, _, err = cli.Run("core", "download", "Arduino:Samd@1.8.12")
256+
require.NoError(t, err)
257+
require.FileExists(t, cli.DownloadDir().Join("packages", "core-ArduinoCore-samd-1.8.12.tar.bz2").String())
258+
}

test/test_core.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,26 +47,6 @@ def test_core_install_esp32(run_command, data_dir):
4747
assert (build_dir / f"{sketch_name}.ino.partitions.bin").exists()
4848

4949

50-
def test_core_download(run_command, downloads_dir):
51-
assert run_command(["core", "update-index"])
52-
53-
# Download a specific core version
54-
assert run_command(["core", "download", "arduino:avr@1.6.16"])
55-
assert os.path.exists(os.path.join(downloads_dir, "packages", "avr-1.6.16.tar.bz2"))
56-
57-
# Wrong core version
58-
result = run_command(["core", "download", "arduino:avr@69.42.0"])
59-
assert result.failed
60-
61-
# Wrong core
62-
result = run_command(["core", "download", "bananas:avr"])
63-
assert result.failed
64-
65-
# Wrong casing
66-
result = run_command(["core", "download", "Arduino:Samd@1.8.12"])
67-
assert os.path.exists(os.path.join(downloads_dir, "packages", "core-ArduinoCore-samd-1.8.12.tar.bz2"))
68-
69-
7050
def _in(jsondata, name, version=None):
7151
installed_cores = json.loads(jsondata)
7252
for c in installed_cores:

0 commit comments

Comments
 (0)