Skip to content

[skip-changelog] Migrate tests from test_compile_part_1.py to compile_part_1_test.go #1861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Migrate TestCompileBlacklistedSketchname from test_compile_part_1.py …
…to compile_part_1_test.go
  • Loading branch information
MatteoPologruto committed Sep 23, 2022
commit c1115d2a53d619a640e0fc5d146ff8dedd2c4d0c
29 changes: 29 additions & 0 deletions internal/integrationtest/compile/compile_part_1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,32 @@ func TestCompileWithSketchWithSymlinkSelfloop(t *testing.T) {
require.Contains(t, string(stderr), "Error opening sketch:")
require.Error(t, err)
}

func TestCompileBlacklistedSketchname(t *testing.T) {
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
defer env.CleanUp()

// Compile should ignore folders named `RCS`, `.git` and the likes, but
// it should be ok for a sketch to be named like RCS.ino

// Init the environment explicitly
_, _, err := cli.Run("core", "update-index")
require.NoError(t, err)

// Install Arduino AVR Boards
_, _, err = cli.Run("core", "install", "arduino:avr@1.8.3")
require.NoError(t, err)

sketchName := "RCS"
sketchPath := cli.SketchbookDir().Join(sketchName)
fqbn := "arduino:avr:uno"

// Create a test sketch
stdout, _, err := cli.Run("sketch", "new", sketchPath.String())
require.NoError(t, err)
require.Contains(t, string(stdout), "Sketch created in: "+sketchPath.String())

// Build sketch for arduino:avr:uno
_, _, err = cli.Run("compile", "-b", fqbn, sketchPath.String())
require.NoError(t, err)
}
25 changes: 0 additions & 25 deletions test/test_compile_part_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,6 @@
from .common import running_on_ci


def test_compile_blacklisted_sketchname(run_command, data_dir):
"""
Compile should ignore folders named `RCS`, `.git` and the likes, but
it should be ok for a sketch to be named like RCS.ino
"""
# Init the environment explicitly
run_command(["core", "update-index"])

# Install Arduino AVR Boards
run_command(["core", "install", "arduino:avr@1.8.3"])

sketch_name = "RCS"
sketch_path = os.path.join(data_dir, sketch_name)
fqbn = "arduino:avr:uno"

# Create a test sketch
result = run_command(["sketch", "new", sketch_path])
assert result.ok
assert "Sketch created in: {}".format(sketch_path) in result.stdout

# Build sketch for arduino:avr:uno
result = run_command(["compile", "-b", fqbn, sketch_path])
assert result.ok


def test_compile_without_precompiled_libraries(run_command, data_dir):
# Init the environment explicitly
url = "https://adafruit.github.io/arduino-board-index/package_adafruit_index.json"
Expand Down