Skip to content

Commit 2453d09

Browse files
Migrate TestCoreUpgradeRemovesUnusedTools from test_core.py to core_test.go
1 parent 8daa1fa commit 2453d09

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

internal/integrationtest/core/core_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,3 +488,26 @@ func TestCoreListUpdatableAllFlags(t *testing.T) {
488488
}
489489
]`)
490490
}
491+
492+
func TestCoreUpgradeRemovesUnusedTools(t *testing.T) {
493+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
494+
defer env.CleanUp()
495+
496+
_, _, err := cli.Run("core", "update-index")
497+
require.NoError(t, err)
498+
499+
// Installs a core
500+
_, _, err = cli.Run("core", "install", "arduino:avr@1.8.2")
501+
require.NoError(t, err)
502+
503+
// Verifies expected tool is installed
504+
toolPath := cli.DataDir().Join("packages", "arduino", "tools", "avr-gcc", "7.3.0-atmel3.6.1-arduino5")
505+
require.DirExists(t, toolPath.String())
506+
507+
// Upgrades core
508+
_, _, err = cli.Run("core", "upgrade", "arduino:avr")
509+
require.NoError(t, err)
510+
511+
// Verifies tool is uninstalled since it's not used by newer core version
512+
require.NoDirExists(t, toolPath.String())
513+
}

test/test_core.py

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

7070

71-
def test_core_upgrade_removes_unused_tools(run_command, data_dir):
72-
assert run_command(["update"])
73-
74-
# Installs a core
75-
assert run_command(["core", "install", "arduino:avr@1.8.2"])
76-
77-
# Verifies expected tool is installed
78-
tool_path = Path(data_dir, "packages", "arduino", "tools", "avr-gcc", "7.3.0-atmel3.6.1-arduino5")
79-
assert tool_path.exists()
80-
81-
# Upgrades core
82-
assert run_command(["core", "upgrade", "arduino:avr"])
83-
84-
# Verifies tool is uninstalled since it's not used by newer core version
85-
assert not tool_path.exists()
86-
87-
8871
def test_core_install_removes_unused_tools(run_command, data_dir):
8972
assert run_command(["update"])
9073

0 commit comments

Comments
 (0)