Skip to content

Commit 788c77c

Browse files
Migrate TestSketchArchiveRelativeSketchPathWithRelativeZipPath from test_sketch.py to sketch_test.go
1 parent 9565b9a commit 788c77c

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
@@ -225,3 +225,21 @@ func TestSketchArchiveAbsoluteSketchPath(t *testing.T) {
225225
defer require.NoError(t, archive.Close())
226226
verifyZipContainsSketchExcludingBuildDir(t, archive.File)
227227
}
228+
229+
func TestSketchArchiveRelativeSketchPathWithRelativeZipPath(t *testing.T) {
230+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
231+
defer env.CleanUp()
232+
233+
_ = cli.CopySketch("sketch_simple")
234+
// Creates a folder where to save the zip
235+
archivesFolder := cli.WorkingDir().Join("my_archives")
236+
require.NoError(t, archivesFolder.Mkdir())
237+
238+
_, _, err := cli.Run("sketch", "archive", "./sketch_simple", "./my_archives")
239+
require.NoError(t, err)
240+
241+
archive, err := zip.OpenReader(cli.WorkingDir().Join("my_archives", "sketch_simple.zip").String())
242+
require.NoError(t, err)
243+
defer require.NoError(t, archive.Close())
244+
verifyZipContainsSketchExcludingBuildDir(t, archive.File)
245+
}

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_relative_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", "./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_relative_sketch_path_with_absolute_zip_path(run_command, copy_sketch, working_dir):
6952
copy_sketch("sketch_simple")
7053
# Creates a folder where to save the zip

0 commit comments

Comments
 (0)