Skip to content

Commit e4b60a1

Browse files
Migrate TestCompileSketchWithPdeExtension from test_compile_part_3.py to compile_part_3_test.go
1 parent 063f4f8 commit e4b60a1

File tree

2 files changed

+61
-30
lines changed

2 files changed

+61
-30
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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 license@arduino.cc.
15+
16+
package compile_part_1_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 TestCompileSketchWithPdeExtension(t *testing.T) {
26+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
27+
defer env.CleanUp()
28+
29+
// Init the environment explicitly
30+
_, _, err := cli.Run("update")
31+
require.NoError(t, err)
32+
33+
// Install core to compile
34+
_, _, err = cli.Run("core", "install", "arduino:avr@1.8.3")
35+
require.NoError(t, err)
36+
37+
sketchName := "CompilePdeSketch"
38+
sketchPath := cli.SketchbookDir().Join(sketchName)
39+
fqbn := "arduino:avr:uno"
40+
41+
// Create a test sketch
42+
_, _, err = cli.Run("sketch", "new", sketchPath.String())
43+
require.NoError(t, err)
44+
45+
sketchFileIno := sketchPath.Join(sketchName + ".ino")
46+
sketchFilePde := sketchPath.Join(sketchName + ".pde")
47+
err = sketchFileIno.Rename(sketchFilePde)
48+
require.NoError(t, err)
49+
50+
// Build sketch from folder
51+
_, stderr, err := cli.Run("compile", "--clean", "-b", fqbn, sketchPath.String())
52+
require.NoError(t, err)
53+
require.Contains(t, string(stderr), "Sketches with .pde extension are deprecated, please rename the following files to .ino:")
54+
require.Contains(t, string(stderr), sketchFilePde.String())
55+
56+
// Build sketch from file
57+
_, stderr, err = cli.Run("compile", "--clean", "-b", fqbn, sketchFilePde.String())
58+
require.NoError(t, err)
59+
require.Contains(t, string(stderr), "Sketches with .pde extension are deprecated, please rename the following files to .ino:")
60+
require.Contains(t, string(stderr), sketchFilePde.String())
61+
}

test/test_compile_part_3.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,36 +39,6 @@
3939
# assert "Skipping dependencies detection for precompiled library Arduino_TensorFlowLite" in result.stdout
4040

4141

42-
def test_compile_sketch_with_pde_extension(run_command, data_dir):
43-
# Init the environment explicitly
44-
assert run_command(["update"])
45-
46-
# Install core to compile
47-
assert run_command(["core", "install", "arduino:avr@1.8.3"])
48-
49-
sketch_name = "CompilePdeSketch"
50-
sketch_path = Path(data_dir, sketch_name)
51-
fqbn = "arduino:avr:uno"
52-
53-
# Create a test sketch
54-
assert run_command(["sketch", "new", sketch_path])
55-
56-
# Renames sketch file to pde
57-
sketch_file = Path(sketch_path, f"{sketch_name}.ino").rename(sketch_path / f"{sketch_name}.pde")
58-
59-
# Build sketch from folder
60-
res = run_command(["compile", "--clean", "-b", fqbn, sketch_path])
61-
assert res.ok
62-
assert "Sketches with .pde extension are deprecated, please rename the following files to .ino:" in res.stderr
63-
assert str(sketch_file) in res.stderr
64-
65-
# Build sketch from file
66-
res = run_command(["compile", "--clean", "-b", fqbn, sketch_file])
67-
assert res.ok
68-
assert "Sketches with .pde extension are deprecated, please rename the following files to .ino" in res.stderr
69-
assert str(sketch_file) in res.stderr
70-
71-
7242
def test_compile_sketch_with_multiple_main_files(run_command, data_dir):
7343
# Init the environment explicitly
7444
assert run_command(["update"])

0 commit comments

Comments
 (0)