Skip to content

Commit dea6b30

Browse files
Migrate TestSketchArchiveAbsoluteSketchPathWithAbsoluteZipPathAndNameWithoutExtensionWithIncludeBuildDirFlag from test_sketch.py to sketch_test.go
1 parent 1257116 commit dea6b30

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
@@ -791,3 +791,21 @@ func TestSketchArchiveAbsoluteSketchPathWithRelativeZipPathAndNameWithExtensionW
791791
defer require.NoError(t, archive.Close())
792792
verifyZipContainsSketchIncludingBuildDir(t, archive.File)
793793
}
794+
795+
func TestSketchArchiveAbsoluteSketchPathWithAbsoluteZipPathAndNameWithoutExtensionWithIncludeBuildDirFlag(t *testing.T) {
796+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
797+
defer env.CleanUp()
798+
799+
_ = cli.CopySketch("sketch_simple")
800+
// Creates a folder where to save the zip
801+
archivesFolder := cli.WorkingDir().Join("my_archives")
802+
require.NoError(t, archivesFolder.Mkdir())
803+
804+
_, _, err := cli.Run("sketch", "archive", cli.WorkingDir().Join("sketch_simple").String(), archivesFolder.Join("my_custom_sketch").String(), "--include-build-dir")
805+
require.NoError(t, err)
806+
807+
archive, err := zip.OpenReader(archivesFolder.Join("my_custom_sketch.zip").String())
808+
require.NoError(t, err)
809+
defer require.NoError(t, archive.Close())
810+
verifyZipContainsSketchIncludingBuildDir(t, archive.File)
811+
}

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_absolute_zip_path_and_name_without_extension_with_include_build_dir_flag( # noqa
52-
run_command, copy_sketch, working_dir
53-
):
54-
# Creates a folder where to save the zip
55-
archives_folder = f"{working_dir}/my_archives/"
56-
Path(archives_folder).mkdir()
57-
58-
result = run_command(
59-
[
60-
"sketch",
61-
"archive",
62-
f"{working_dir}/sketch_simple",
63-
f"{archives_folder}/my_custom_sketch",
64-
"--include-build-dir",
65-
],
66-
copy_sketch("sketch_simple"),
67-
)
68-
assert result.ok
69-
70-
archive = zipfile.ZipFile(f"{archives_folder}/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_with_extension_with_include_build_dir_flag(
7952
run_command, copy_sketch, working_dir
8053
):

0 commit comments

Comments
 (0)