Skip to content

Commit 614e537

Browse files
Migrate TestCompileWithProfiles from test_profiles.py to profiles_test.go
1 parent 87d2efa commit 614e537

File tree

4 files changed

+45
-16
lines changed

4 files changed

+45
-16
lines changed

Diff for: internal/integrationtest/profiles/profiles_test.go

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// This file is part of arduino-cli.
2+
//
3+
// Copyright 2022 ARDUINO SA (http://www.arduino.cc/)
4+
//
5+
// This software is released under the GNU General Public License version 3,
6+
// which covers the main part of arduino-cli.
7+
// The terms of this license can be found at:
8+
// https://www.gnu.org/licenses/gpl-3.0.en.html
9+
//
10+
// You can be released from the requirements of the above licenses by purchasing
11+
// a commercial license. Buying such a license is mandatory if you want to
12+
// modify or otherwise use the software for commercial activities involving the
13+
// Arduino software without disclosing the source code of your own applications.
14+
// To purchase a commercial license, send an email to [email protected].
15+
16+
package profiles_test
17+
18+
import (
19+
"testing"
20+
21+
"github.com/arduino/arduino-cli/internal/integrationtest"
22+
"github.com/stretchr/testify/require"
23+
)
24+
25+
func TestCompileWithProfiles(t *testing.T) {
26+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
27+
defer env.CleanUp()
28+
29+
// Init the environment explicitly
30+
_, _, err := cli.Run("core", "update-index")
31+
require.NoError(t, err)
32+
33+
// copy sketch_with_profile into the working directory
34+
sketchPath := cli.CopySketch("sketch_with_profile")
35+
36+
// use profile without a required library -> should fail
37+
_, _, err = cli.Run("lib", "install", "Arduino_JSON")
38+
require.NoError(t, err)
39+
_, _, err = cli.Run("compile", "-m", "avr1", sketchPath.String())
40+
require.Error(t, err)
41+
42+
// use profile with the required library -> should succeed
43+
_, _, err = cli.Run("compile", "-m", "avr2", sketchPath.String())
44+
require.NoError(t, err)
45+
}

Diff for: test/test_profiles.py

-16
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,6 @@
1414
# a commercial license, send an email to [email protected].
1515

1616

17-
def test_compile_with_profiles(run_command, copy_sketch):
18-
# Init the environment explicitly
19-
run_command(["core", "update-index"])
20-
21-
sketch_path = copy_sketch("sketch_with_profile")
22-
23-
# use profile without a required library -> should fail
24-
assert run_command(["lib", "install", "Arduino_JSON"])
25-
result = run_command(["compile", "-m", "avr1", sketch_path])
26-
assert result.failed
27-
28-
# use profile with the required library -> should succeed
29-
result = run_command(["compile", "-m", "avr2", sketch_path])
30-
assert result.ok
31-
32-
3317
def test_builder_did_not_catch_libs_from_unused_platforms(run_command, copy_sketch):
3418
# Init the environment explicitly
3519
run_command(["core", "update-index"])

0 commit comments

Comments
 (0)