Skip to content

Commit 7225856

Browse files
Migrate TestSketchArchiveRelativeSketchPathWithAbsoluteZipPathAndNameWithoutExtension from test_sketch.py to sketch_test.go
1 parent 82c8d15 commit 7225856

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

internal/integrationtest/sketch/sketch_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,3 +297,21 @@ func TestSketchArchiveRelativeSketchPathWithRelativeZipPathAndNameWithExtension(
297297
defer require.NoError(t, archive.Close())
298298
verifyZipContainsSketchExcludingBuildDir(t, archive.File)
299299
}
300+
301+
func TestSketchArchiveRelativeSketchPathWithAbsoluteZipPathAndNameWithoutExtension(t *testing.T) {
302+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
303+
defer env.CleanUp()
304+
305+
_ = cli.CopySketch("sketch_simple")
306+
// Creates a folder where to save the zip
307+
archivesFolder := cli.WorkingDir().Join("my_archives")
308+
require.NoError(t, archivesFolder.Mkdir())
309+
310+
_, _, err := cli.Run("sketch", "archive", "./sketch_simple", archivesFolder.Join("my_custom_sketch").String())
311+
require.NoError(t, err)
312+
313+
archive, err := zip.OpenReader(archivesFolder.Join("my_custom_sketch.zip").String())
314+
require.NoError(t, err)
315+
defer require.NoError(t, archive.Close())
316+
verifyZipContainsSketchExcludingBuildDir(t, archive.File)
317+
}

test/test_sketch.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,25 +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(
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(["sketch", "archive", "./sketch_simple", f"{archives_folder}/my_custom_sketch"])
60-
assert result.ok
61-
62-
archive = zipfile.ZipFile(f"{archives_folder}/my_custom_sketch.zip")
63-
archive_files = archive.namelist()
64-
65-
verify_zip_contains_sketch_excluding_build_dir(archive_files)
66-
67-
archive.close()
68-
69-
7051
def test_sketch_archive_relative_sketch_path_with_absolute_zip_path_and_name_with_extension(
7152
run_command, copy_sketch, working_dir
7253
):

0 commit comments

Comments
 (0)