Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert component-based scripts lookup #3540

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/paths/script_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def __init__(self, kind: str, paths: List[str]) -> None:
For build.sh and integtest.sh scripts, given a component name and a checked-out Git repository,
it will look in the following locations, in order:
* <component_scripts_path>/<component_name>/<script-name>
* /<component_name>/<script-name> in the component's Git repository
* root of the component's Git repository
* /scripts/<script-name> in the component's Git repository
* <default_scripts_path>/<script-name>
Expand All @@ -49,7 +48,6 @@ def __find_script(cls, name: str, paths: List[str]) -> str:
def __find_named_script(cls, script_name: str, component_name: str, git_dir: str) -> str:
paths = [
os.path.realpath(os.path.join(cls.component_scripts_path, component_name, script_name)),
os.path.realpath(os.path.join(git_dir, component_name, script_name)),
os.path.realpath(os.path.join(git_dir, script_name)),
os.path.realpath(os.path.join(git_dir, "scripts", script_name)),
os.path.realpath(os.path.join(cls.default_scripts_path, script_name)),
Expand All @@ -61,7 +59,6 @@ def __find_named_script(cls, script_name: str, component_name: str, git_dir: str
def find_build_script(cls, project: str, component_name: str, git_dir: str) -> str:
paths = [
os.path.realpath(os.path.join(cls.component_scripts_path, component_name, "build.sh")),
os.path.realpath(os.path.join(git_dir, component_name, "build.sh")),
os.path.realpath(os.path.join(git_dir, "build.sh")),
os.path.realpath(os.path.join(git_dir, "scripts", "build.sh")),
os.path.realpath(
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

22 changes: 0 additions & 22 deletions tests/tests_paths/test_script_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def setUp(self) -> None:
self.component_with_scripts = os.path.join(self.data_path, "git", "component-with-scripts")
self.component_with_scripts_folder = os.path.join(self.data_path, "git", "component-with-scripts-folder")
self.component_without_scripts = os.path.join(self.data_path, "git", "component-without-scripts")
self.component_with_scripts_in_component_folder = os.path.join(self.data_path, "git", "component_with_scripts_in_component_folder")

# find_build_script

Expand Down Expand Up @@ -66,13 +65,6 @@ def test_find_build_script_component_script_in_folder_with_default(self) -> None
msg="A component with a scripts folder resolves to the override.",
)

def test_find_build_script_component_script_in_component_folder(self) -> None:
self.assertEqual(
os.path.join(self.component_with_scripts_in_component_folder, "Component", "build.sh"),
ScriptFinder.find_build_script("Component", "Component", self.component_with_scripts_in_component_folder),
msg="A component with a script in component folder resolves to the override.",
)

@patch("os.path.exists", return_value=False)
def test_find_build_script_does_not_exist(self, *mocks: MagicMock) -> None:
with self.assertRaisesRegex(
Expand Down Expand Up @@ -118,13 +110,6 @@ def test_find_integ_test_script_component_script_in_folder_with_default(self) ->
msg="A component with a scripts folder resolves to a script in that folder.",
)

def test_find_integ_test_script_component_script_in_component_folder(self) -> None:
self.assertEqual(
os.path.join(self.component_with_scripts_in_component_folder, "Component", "integtest.sh"),
ScriptFinder.find_integ_test_script("Component", self.component_with_scripts_in_component_folder),
msg="A component with a script in component folder resolves to the override.",
)

@patch("os.path.exists", return_value=False)
def test_find_integ_test_script_does_not_exist(self, *mocks: MagicMock) -> None:
with self.assertRaisesRegex(
Expand Down Expand Up @@ -194,13 +179,6 @@ def test_find_bwc_test_script_component_script_in_folder_with_default(self) -> N
msg="A component with a scripts folder resolves to a script in that folder.",
)

def test_find_bwc_test_script_component_script_in_component_folder(self) -> None:
self.assertEqual(
os.path.join(ScriptFinder.default_scripts_path, "bwctest.sh"),
ScriptFinder.find_bwc_test_script("Component", self.component_with_scripts_in_component_folder),
msg="A component with a script in component folder resolves to the override.",
)

@patch("os.path.exists", return_value=False)
def test_find_bwc_test_script_does_not_exist(self, *mocks: MagicMock) -> None:
with self.assertRaisesRegex(
Expand Down