Skip to content

Commit

Permalink
feat: exclude test from all subdirectories by default (#255)
Browse files Browse the repository at this point in the history
* feat: exclude test from all subdirectories by default

* test: adjust tests for new zip default value
  • Loading branch information
patrzhan authored Oct 23, 2023
1 parent 399f79c commit dcf3b1e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion gdk/build_system/Zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def get_ignored_file_patterns(self, project_config: ComponentBuildConfiguration)
if not options:
ignore_list.extend(
[
"test*",
"**/test*",
"**/.*",
"**/node_modules",
]
Expand Down
16 changes: 8 additions & 8 deletions integration_tests/gdk/components/test_integ_BuildCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ def test_GIVEN_zip_build_system_WHEN_build_THEN_build_zip_artifacts(self):
bc = BuildCommand({})
bc.run()
build_recipe_file = self.tmpdir.joinpath("greengrass-build/recipes/recipe.yaml").resolve()
included_file_path = f"zip-build/{self.tmpdir.name}/src/test_do_want_this_file.txt"
excluded_file_path = f"zip-build/{self.tmpdir.name}/test_dont_want_this_file.txt"
test_file_included = self.tmpdir.joinpath(included_file_path).resolve()
test_file_excluded = self.tmpdir.joinpath(excluded_file_path).resolve()
test_subdir_file_path = f"zip-build/{self.tmpdir.name}/src/test_subdir.txt"
test_root_file_path = f"zip-build/{self.tmpdir.name}/test_root.txt"
test_root_file = self.tmpdir.joinpath(test_root_file_path).resolve()
test_subdir_file = self.tmpdir.joinpath(test_subdir_file_path).resolve()
node_modules_root_excluded = self.tmpdir.joinpath(f"zip-build/{self.tmpdir.name}/node_modules").resolve()
node_modules_subdir_excluded = self.tmpdir.joinpath(f"zip-build/{self.tmpdir.name}/src/node_modules").resolve()
node_modules_file_path = f"zip-build/{self.tmpdir.name}/src/node_modules/excluded_file.txt"
node_modules_file_excluded = self.tmpdir.joinpath(node_modules_file_path).resolve()

assert self.tmpdir.joinpath(f"greengrass-build/artifacts/abc/NEXT_PATCH/{self.tmpdir.name}.zip").exists()
assert build_recipe_file.exists()
assert test_file_included.exists()
assert not test_file_excluded.exists()
assert not test_root_file.exists()
assert not test_subdir_file.exists()
assert not node_modules_root_excluded.exists()
assert not node_modules_subdir_excluded.exists()
assert not node_modules_file_excluded.exists()
Expand Down Expand Up @@ -170,9 +170,9 @@ def zip_test_data(self):
f.write(recipe)

self.tmpdir.joinpath("hello_world.py").touch()
self.tmpdir.joinpath("test_dont_want_this_file.txt").touch()
self.tmpdir.joinpath("test_root.txt").touch()
self.tmpdir.joinpath("src").mkdir()
self.tmpdir.joinpath("src", "test_do_want_this_file.txt").touch()
self.tmpdir.joinpath("src", "test_subdir.txt").touch()
self.tmpdir.joinpath("node_modules").mkdir()
self.tmpdir.joinpath("src", "node_modules").mkdir()
self.tmpdir.joinpath("src", "node_modules", "excluded_file.txt").touch()
Expand Down
2 changes: 1 addition & 1 deletion tests/gdk/build_system/test_Zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_zip_ignore_list_without_exclude_option(self):
"gdk-config.json",
"greengrass-build",
"recipe.json",
"test*",
"**/test*",
"**/.*",
"**/node_modules",
] == zip.get_ignored_file_patterns(config)
Expand Down

0 comments on commit dcf3b1e

Please sign in to comment.