Skip to content

Commit 8c11677

Browse files
Migrate TestSketchArchiveRelativeSketchPathWithAbsoluteZipPathAndNameWithoutExtensionWithIncludeBuildDirFlag from test_sketch.py to sketch_test.go
1 parent 5088735 commit 8c11677

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

internal/integrationtest/sketch/sketch_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,3 +683,21 @@ func TestSketchArchiveRelativeSketchPathWithRelativeZipPathAndNameWithExtensionW
683683
defer require.NoError(t, archive.Close())
684684
verifyZipContainsSketchIncludingBuildDir(t, archive.File)
685685
}
686+
687+
func TestSketchArchiveRelativeSketchPathWithAbsoluteZipPathAndNameWithoutExtensionWithIncludeBuildDirFlag(t *testing.T) {
688+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
689+
defer env.CleanUp()
690+
691+
_ = cli.CopySketch("sketch_simple")
692+
// Creates a folder where to save the zip
693+
archivesFolder := cli.WorkingDir().Join("my_archives")
694+
require.NoError(t, archivesFolder.Mkdir())
695+
696+
_, _, err := cli.Run("sketch", "archive", "./sketch_simple", archivesFolder.Join("my_custom_sketch").String(), "--include-build-dir")
697+
require.NoError(t, err)
698+
699+
archive, err := zip.OpenReader(archivesFolder.Join("my_custom_sketch.zip").String())
700+
require.NoError(t, err)
701+
defer require.NoError(t, archive.Close())
702+
verifyZipContainsSketchIncludingBuildDir(t, archive.File)
703+
}

test/test_sketch.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,27 +48,6 @@ def verify_zip_contains_sketch_including_build_dir(files):
4848
assert "sketch_simple/build/arduino.avr.uno/sketch_simple.ino.with_bootloader.hex" in files
4949

5050

51-
def test_sketch_archive_relative_sketch_path_with_absolute_zip_path_and_name_without_extension_with_include_build_dir_flag( # noqa
52-
run_command, copy_sketch, working_dir
53-
):
54-
copy_sketch("sketch_simple")
55-
# Creates a folder where to save the zip
56-
archives_folder = f"{working_dir}/my_archives/"
57-
Path(archives_folder).mkdir()
58-
59-
result = run_command(
60-
["sketch", "archive", "./sketch_simple", f"{archives_folder}/my_custom_sketch", "--include-build-dir"]
61-
)
62-
assert result.ok
63-
64-
archive = zipfile.ZipFile(f"{archives_folder}/my_custom_sketch.zip")
65-
archive_files = archive.namelist()
66-
67-
verify_zip_contains_sketch_including_build_dir(archive_files)
68-
69-
archive.close()
70-
71-
7251
def test_sketch_archive_relative_sketch_path_with_absolute_zip_path_and_name_with_extension_with_include_build_dir_flag(
7352
run_command, copy_sketch, working_dir
7453
):

0 commit comments

Comments
 (0)