Skip to content

Commit 8344183

Browse files
Migrate TestCompileManuallyInstalledPlatform from test_compile_part_3.py to compile_part_3_test.go
1 parent d6e79aa commit 8344183

File tree

2 files changed

+33
-20
lines changed

2 files changed

+33
-20
lines changed

Diff for: internal/integrationtest/compile/compile_part_3_test.go

+33
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import (
2222
"github.com/arduino/arduino-cli/internal/integrationtest"
2323
"github.com/arduino/go-paths-helper"
2424
"github.com/stretchr/testify/require"
25+
"gopkg.in/src-d/go-git.v4"
26+
"gopkg.in/src-d/go-git.v4/plumbing"
2527
)
2628

2729
func TestCompileSketchWithPdeExtesnion(t *testing.T) {
@@ -250,3 +252,34 @@ func TestCompileUsingBoardsLocalTxt(t *testing.T) {
250252
_, _, err = cli.Run("compile", "--clean", "-b", fqbn, sketchPath.String())
251253
require.NoError(t, err)
252254
}
255+
256+
func TestCompileManuallyInstalledPlatform(t *testing.T) {
257+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
258+
defer env.CleanUp()
259+
260+
_, _, err := cli.Run("update")
261+
require.NoError(t, err)
262+
263+
sketchName := "CompileSketchManuallyInstalledPlatformUsingPlatformLocalTxt"
264+
sketchPath := cli.SketchbookDir().Join(sketchName)
265+
fqbn := "arduino-beta-development:avr:uno"
266+
_, _, err = cli.Run("sketch", "new", sketchPath.String())
267+
require.NoError(t, err)
268+
269+
// Manually installs a core in sketchbooks hardware folder
270+
gitUrl := "https://github.com/arduino/ArduinoCore-avr.git"
271+
repoDir := cli.SketchbookDir().Join("hardware", "arduino-beta-development", "avr")
272+
_, err = git.PlainClone(repoDir.String(), false, &git.CloneOptions{
273+
URL: gitUrl,
274+
ReferenceName: plumbing.NewTagReferenceName("1.8.3"),
275+
})
276+
require.NoError(t, err)
277+
278+
// Installs also the same core via CLI so all the necessary tools are installed
279+
_, _, err = cli.Run("core", "install", "arduino:[email protected]")
280+
require.NoError(t, err)
281+
282+
// Verifies compilation works without issues
283+
_, _, err = cli.Run("compile", "--clean", "-b", fqbn, sketchPath.String())
284+
require.NoError(t, err)
285+
}

Diff for: test/test_compile_part_3.py

-20
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,6 @@
3939
# assert "Skipping dependencies detection for precompiled library Arduino_TensorFlowLite" in result.stdout
4040

4141

42-
def test_compile_manually_installed_platform(run_command, data_dir):
43-
assert run_command(["update"])
44-
45-
sketch_name = "CompileSketchManuallyInstalledPlatformUsingPlatformLocalTxt"
46-
sketch_path = Path(data_dir, sketch_name)
47-
fqbn = "arduino-beta-development:avr:uno"
48-
assert run_command(["sketch", "new", sketch_path])
49-
50-
# Manually installs a core in sketchbooks hardware folder
51-
git_url = "https://github.com/arduino/ArduinoCore-avr.git"
52-
repo_dir = Path(data_dir, "hardware", "arduino-beta-development", "avr")
53-
assert Repo.clone_from(git_url, repo_dir, multi_options=["-b 1.8.3"])
54-
55-
# Installs also the same core via CLI so all the necessary tools are installed
56-
assert run_command(["core", "install", "arduino:[email protected]"])
57-
58-
# Verifies compilation works without issues
59-
assert run_command(["compile", "--clean", "-b", fqbn, sketch_path])
60-
61-
6242
def test_compile_manually_installed_platform_using_platform_local_txt(run_command, data_dir):
6343
assert run_command(["update"])
6444

0 commit comments

Comments
 (0)