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 TestOutputFlagDefaultPath from test_compile_part_1.py to comp…
…ile_part_1_test.go
  • Loading branch information
MatteoPologruto committed Sep 23, 2022
commit 63e6be19e118fd2fa18465b57d742cd1ae2fe12c
28 changes: 28 additions & 0 deletions internal/integrationtest/compile/compile_part_1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,31 @@ func TestCompileWithSimpleSketch(t *testing.T) {
require.NoFileExists(t, sketchBuildDir.Join(sketchName+".ino.with_bootloader.bin").String())
require.NoFileExists(t, sketchBuildDir.Join(sketchName+".ino.with_bootloader.hex").String())
}

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

// 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)

// Create a test sketch
sketchPath := cli.SketchbookDir().Join("test_output_flag_default_path")
fqbn := "arduino:avr:uno"
_, _, err = cli.Run("sketch", "new", sketchPath.String())
require.NoError(t, err)

// Test the --output-dir flag defaulting to current working dir
workingDir, err := paths.Getwd()
require.NoError(t, err)
target := workingDir.Join("test")
defer target.RemoveAll()
_, _, err = cli.Run("compile", "-b", fqbn, sketchPath.String(), "--output-dir", "test")
require.NoError(t, err)
require.DirExists(t, target.String())
}
24 changes: 0 additions & 24 deletions test/test_compile_part_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,6 @@
from .common import running_on_ci


@pytest.mark.skipif(
running_on_ci() and platform.system() == "Windows",
reason="Test disabled on Github Actions Win VM until tmpdir inconsistent behavior bug is fixed",
)
def test_output_flag_default_path(run_command, data_dir, working_dir):
# Init the environment explicitly
run_command(["core", "update-index"])

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

# Create a test sketch
sketch_path = os.path.join(data_dir, "test_output_flag_default_path")
fqbn = "arduino:avr:uno"
result = run_command(["sketch", "new", sketch_path])
assert result.ok

# Test the --output-dir flag defaulting to current working dir
result = run_command(["compile", "-b", fqbn, sketch_path, "--output-dir", "test"])
assert result.ok
target = os.path.join(working_dir, "test")
assert os.path.exists(target) and os.path.isdir(target)


def test_compile_with_sketch_with_symlink_selfloop(run_command, data_dir):
# Init the environment explicitly
run_command(["core", "update-index"])
Expand Down