Skip to content

Commit 803b0da

Browse files
Migrate TestSketchArchiveAbsoluteSketchPathWithRelativeZipPathAndNameWithoutExtensionWithIncludeBuildDirFlag from test_sketch.py to sketch_test.go
1 parent 00003e3 commit 803b0da

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

internal/integrationtest/sketch/sketch_test.go

+18
Original file line numberDiff line numberDiff line change
@@ -755,3 +755,21 @@ func TestSketchArchiveAbsoluteSketchPathWithAbsoluteZipPathWithIncludeBuildDirFl
755755
defer require.NoError(t, archive.Close())
756756
verifyZipContainsSketchIncludingBuildDir(t, archive.File)
757757
}
758+
759+
func TestSketchArchiveAbsoluteSketchPathWithRelativeZipPathAndNameWithoutExtensionWithIncludeBuildDirFlag(t *testing.T) {
760+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
761+
defer env.CleanUp()
762+
763+
_ = cli.CopySketch("sketch_simple")
764+
// Creates a folder where to save the zip
765+
archivesFolder := cli.WorkingDir().Join("my_archives")
766+
require.NoError(t, archivesFolder.Mkdir())
767+
768+
_, _, err := cli.Run("sketch", "archive", cli.WorkingDir().Join("sketch_simple").String(), "./my_archives/my_custom_sketch", "--include-build-dir")
769+
require.NoError(t, err)
770+
771+
archive, err := zip.OpenReader(cli.WorkingDir().Join("my_archives", "my_custom_sketch.zip").String())
772+
require.NoError(t, err)
773+
defer require.NoError(t, archive.Close())
774+
verifyZipContainsSketchIncludingBuildDir(t, archive.File)
775+
}

test/test_sketch.py

-21
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_absolute_sketch_path_with_relative_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", f"{working_dir}/sketch_simple", "./my_archives/my_custom_sketch", "--include-build-dir"]
61-
)
62-
assert result.ok
63-
64-
archive = zipfile.ZipFile(f"{working_dir}/my_archives/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_absolute_sketch_path_with_relative_zip_path_and_name_with_extension_with_include_build_dir_flag(
7352
run_command, copy_sketch, working_dir
7453
):

0 commit comments

Comments
 (0)