Skip to content

Commit 3b9ccce

Browse files
Migrate TestSketchArchiveAbsoluteSketchPathWithAbsoluteZipPathAndNameWithExtension from test_sketch.py to sketch_test.go
1 parent f400197 commit 3b9ccce

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
@@ -423,3 +423,21 @@ func TestSketchArchiveAbsoluteSketchPathWithAbsoluteZipPathAndNameWithoutExtensi
423423
defer require.NoError(t, archive.Close())
424424
verifyZipContainsSketchExcludingBuildDir(t, archive.File)
425425
}
426+
427+
func TestSketchArchiveAbsoluteSketchPathWithAbsoluteZipPathAndNameWithExtension(t *testing.T) {
428+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
429+
defer env.CleanUp()
430+
431+
// Creates a folder where to save the zip
432+
archivesFolder := cli.WorkingDir().Join("my_archives")
433+
require.NoError(t, archivesFolder.Mkdir())
434+
435+
cli.SetWorkingDir(cli.CopySketch("sketch_simple"))
436+
_, _, err := cli.Run("sketch", "archive", env.RootDir().Join("sketch_simple").String(), archivesFolder.Join("my_custom_sketch.zip").String())
437+
require.NoError(t, err)
438+
439+
archive, err := zip.OpenReader(archivesFolder.Join("my_custom_sketch.zip").String())
440+
require.NoError(t, err)
441+
defer require.NoError(t, archive.Close())
442+
verifyZipContainsSketchExcludingBuildDir(t, archive.File)
443+
}

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_absolute_sketch_path_with_absolute_zip_path_and_name_with_extension(
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-
["sketch", "archive", f"{working_dir}/sketch_simple", f"{archives_folder}/my_custom_sketch.zip"],
60-
copy_sketch("sketch_simple"),
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_excluding_build_dir(archive_files)
68-
69-
archive.close()
70-
71-
7251
def test_sketch_archive_no_args_with_include_build_dir_flag(run_command, copy_sketch, working_dir):
7352
result = run_command(["sketch", "archive", "--include-build-dir"], copy_sketch("sketch_simple"))
7453
assert result.ok

0 commit comments

Comments
 (0)