Skip to content

Commit 5e0ea1e

Browse files
Migrate TestCoreUninstall from test_core.py to core_test.go
1 parent c21c5f6 commit 5e0ea1e

File tree

2 files changed

+18
-23
lines changed

2 files changed

+18
-23
lines changed

internal/integrationtest/core/core_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,3 +302,21 @@ func TestCoreInstall(t *testing.T) {
302302
require.NoError(t, err)
303303
requirejson.Empty(t, stdout)
304304
}
305+
306+
func TestCoreUninstall(t *testing.T) {
307+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
308+
defer env.CleanUp()
309+
310+
_, _, err := cli.Run("core", "update-index")
311+
require.NoError(t, err)
312+
_, _, err = cli.Run("core", "install", "arduino:avr")
313+
require.NoError(t, err)
314+
stdout, _, err := cli.Run("core", "list", "--format", "json")
315+
require.NoError(t, err)
316+
requirejson.Query(t, stdout, ".[] | select(.id == \"arduino:avr\") | . != \"\"", "true")
317+
_, _, err = cli.Run("core", "uninstall", "arduino:avr")
318+
require.NoError(t, err)
319+
stdout, _, err = cli.Run("core", "list", "--format", "json")
320+
require.NoError(t, err)
321+
requirejson.Empty(t, stdout)
322+
}

test/test_core.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +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 _in(jsondata, name, version=None):
51-
installed_cores = json.loads(jsondata)
52-
for c in installed_cores:
53-
if name == c.get("id"):
54-
if version is None:
55-
return True
56-
elif version == c.get("installed"):
57-
return True
58-
return False
59-
60-
61-
def test_core_uninstall(run_command):
62-
assert run_command(["core", "update-index"])
63-
assert run_command(["core", "install", "arduino:avr"])
64-
result = run_command(["core", "list", "--format", "json"])
65-
assert result.ok
66-
assert _in(result.stdout, "arduino:avr")
67-
assert run_command(["core", "uninstall", "arduino:avr"])
68-
result = run_command(["core", "list", "--format", "json"])
69-
assert result.ok
70-
assert not _in(result.stdout, "arduino:avr")
71-
72-
7350
def test_core_uninstall_tool_dependency_removal(run_command, data_dir):
7451
# These platforms both have a dependency on the arduino:avr-gcc@7.3.0-atmel3.6.1-arduino5 tool
7552
# arduino:avr@1.8.2 has a dependency on arduino:avrdude@6.3.0-arduino17

0 commit comments

Comments
 (0)