Skip to content

Commit db68856

Browse files
Migrate TestSketchArchiveDotArgRelativeZipPathWithIncludeBuildDirFlag from test_sketch.py to sketch_test.go
1 parent 2c3a3eb commit db68856

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

internal/integrationtest/sketch/sketch_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,3 +488,22 @@ func TestSketchArchiveDotArgWithIncludeBuildDirFlag(t *testing.T) {
488488
defer require.NoError(t, archive.Close())
489489
verifyZipContainsSketchIncludingBuildDir(t, archive.File)
490490
}
491+
492+
func TestSketchArchiveDotArgRelativeZipPathWithIncludeBuildDirFlag(t *testing.T) {
493+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
494+
defer env.CleanUp()
495+
496+
// Creates a folder where to save the zip
497+
archivesFolder := cli.WorkingDir().Join("my_archives")
498+
require.NoError(t, archivesFolder.Mkdir())
499+
500+
cli.SetWorkingDir(cli.CopySketch("sketch_simple"))
501+
_, _, err := cli.Run("sketch", "archive", ".", "../my_archives", "--include-build-dir")
502+
require.NoError(t, err)
503+
cli.SetWorkingDir(env.RootDir())
504+
505+
archive, err := zip.OpenReader(cli.WorkingDir().Join("my_archives", "sketch_simple.zip").String())
506+
require.NoError(t, err)
507+
defer require.NoError(t, archive.Close())
508+
verifyZipContainsSketchIncludingBuildDir(t, archive.File)
509+
}

test/test_sketch.py

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

0 commit comments

Comments
 (0)