Skip to content

Commit 1257116

Browse files
Migrate TestSketchArchiveAbsoluteSketchPathWithRelativeZipPathAndNameWithExtensionWithIncludeBuildDirFlag from test_sketch.py to sketch_test.go
1 parent 803b0da commit 1257116

File tree

2 files changed

+18
-27
lines changed

2 files changed

+18
-27
lines changed

internal/integrationtest/sketch/sketch_test.go

+18
Original file line numberDiff line numberDiff line change
@@ -773,3 +773,21 @@ func TestSketchArchiveAbsoluteSketchPathWithRelativeZipPathAndNameWithoutExtensi
773773
defer require.NoError(t, archive.Close())
774774
verifyZipContainsSketchIncludingBuildDir(t, archive.File)
775775
}
776+
777+
func TestSketchArchiveAbsoluteSketchPathWithRelativeZipPathAndNameWithExtensionWithIncludeBuildDirFlag(t *testing.T) {
778+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
779+
defer env.CleanUp()
780+
781+
_ = cli.CopySketch("sketch_simple")
782+
// Creates a folder where to save the zip
783+
archivesFolder := cli.WorkingDir().Join("my_archives")
784+
require.NoError(t, archivesFolder.Mkdir())
785+
786+
_, _, err := cli.Run("sketch", "archive", cli.WorkingDir().Join("sketch_simple").String(), "./my_archives/my_custom_sketch.zip", "--include-build-dir")
787+
require.NoError(t, err)
788+
789+
archive, err := zip.OpenReader(cli.WorkingDir().Join("my_archives", "my_custom_sketch.zip").String())
790+
require.NoError(t, err)
791+
defer require.NoError(t, archive.Close())
792+
verifyZipContainsSketchIncludingBuildDir(t, archive.File)
793+
}

test/test_sketch.py

-27
Original file line numberDiff line numberDiff line change
@@ -48,33 +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_absolute_sketch_path_with_relative_zip_path_and_name_with_extension_with_include_build_dir_flag(
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-
[
61-
"sketch",
62-
"archive",
63-
f"{working_dir}/sketch_simple",
64-
"./my_archives/my_custom_sketch.zip",
65-
"--include-build-dir",
66-
]
67-
)
68-
assert result.ok
69-
70-
archive = zipfile.ZipFile(f"{working_dir}/my_archives/my_custom_sketch.zip")
71-
archive_files = archive.namelist()
72-
73-
verify_zip_contains_sketch_including_build_dir(archive_files)
74-
75-
archive.close()
76-
77-
7851
def test_sketch_archive_absolute_sketch_path_with_absolute_zip_path_and_name_without_extension_with_include_build_dir_flag( # noqa
7952
run_command, copy_sketch, working_dir
8053
):

0 commit comments

Comments
 (0)