Skip to content

Commit 3f6abcb

Browse files
Migrate TestSketchArchiveAbsoluteSketchPathWithRelativeZipPath from test_sketch.py to sketch_test.go
1 parent 9d44213 commit 3f6abcb

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

internal/integrationtest/sketch/sketch_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,3 +333,21 @@ func TestSketchArchiveRelativeSketchPathWithAbsoluteZipPathAndNameWithExtension(
333333
defer require.NoError(t, archive.Close())
334334
verifyZipContainsSketchExcludingBuildDir(t, archive.File)
335335
}
336+
337+
func TestSketchArchiveAbsoluteSketchPathWithRelativeZipPath(t *testing.T) {
338+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
339+
defer env.CleanUp()
340+
341+
_ = cli.CopySketch("sketch_simple")
342+
// Creates a folder where to save the zip
343+
archivesFolder := cli.WorkingDir().Join("my_archives")
344+
require.NoError(t, archivesFolder.Mkdir())
345+
346+
_, _, err := cli.Run("sketch", "archive", cli.WorkingDir().Join("sketch_simple").String(), "./my_archives")
347+
require.NoError(t, err)
348+
349+
archive, err := zip.OpenReader(cli.WorkingDir().Join("my_archives", "sketch_simple.zip").String())
350+
require.NoError(t, err)
351+
defer require.NoError(t, archive.Close())
352+
verifyZipContainsSketchExcludingBuildDir(t, archive.File)
353+
}

test/test_sketch.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +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(run_command, copy_sketch, working_dir):
52-
copy_sketch("sketch_simple")
53-
# Creates a folder where to save the zip
54-
archives_folder = f"{working_dir}/my_archives/"
55-
Path(archives_folder).mkdir()
56-
57-
result = run_command(["sketch", "archive", f"{working_dir}/sketch_simple", "./my_archives"])
58-
assert result.ok
59-
60-
archive = zipfile.ZipFile(f"{working_dir}/my_archives/sketch_simple.zip")
61-
archive_files = archive.namelist()
62-
63-
verify_zip_contains_sketch_excluding_build_dir(archive_files)
64-
65-
archive.close()
66-
67-
6851
def test_sketch_archive_absolute_sketch_path_with_absolute_zip_path(run_command, copy_sketch, working_dir):
6952
# Creates a folder where to save the zip
7053
archives_folder = f"{working_dir}/my_archives/"

0 commit comments

Comments
 (0)