Skip to content

Commit

Permalink
change method name
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeWang1127 committed Apr 18, 2024
1 parent 6266037 commit d4afa4d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions library_generation/test/utilities_unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def test_generate_prerequisite_files_non_monorepo_success(self):
file_comparator.compare_files(
f"{library_path}/owlbot.py", f"{library_path}/owlbot-golden.py"
)
self.__remove_generated_files(path=library_path, is_monorepo=False)
self.__remove_prerequisite_files(path=library_path, is_monorepo=False)

def test_generate_prerequisite_files_monorepo_success(self):
library_path = self.__setup_prerequisite_files(num_libraries=2)
Expand All @@ -329,7 +329,7 @@ def test_generate_prerequisite_files_monorepo_success(self):
file_comparator.compare_files(
f"{library_path}/owlbot.py", f"{library_path}/owlbot-golden.py"
)
self.__remove_generated_files(path=library_path)
self.__remove_prerequisite_files(path=library_path)

def test_prepare_repo_monorepo_success(self):
gen_config = self.__get_a_gen_config(2)
Expand Down Expand Up @@ -375,7 +375,7 @@ def test_prepare_repo_split_repo_success(self):
self.assertEqual("output", Path(repo_config.output_folder).name)
library_path = sorted([Path(key).name for key in repo_config.libraries])
self.assertEqual(["misc"], library_path)
shutil.rmtree(repo_config.output_folder, ignore_errors=True)
shutil.rmtree(repo_config.output_folder)

def __setup_prerequisite_files(
self, num_libraries: int, library_type: str = "GAPIC_AUTO"
Expand Down Expand Up @@ -452,13 +452,14 @@ def __get_a_gen_config(
)

@staticmethod
def __remove_generated_files(path: str, is_monorepo: bool = True) -> None:
def __remove_prerequisite_files(path: str, is_monorepo: bool = True) -> None:
os.remove(f"{path}/.repo-metadata.json")
os.remove(f"{path}/owlbot.py")
if is_monorepo:
os.remove(f"{path}/.OwlBot-hermetic.yaml")
return
shutil.rmtree(f"{path}/.github", ignore_errors=True)
if os.path.isdir(f"{path}/.github"):
shutil.rmtree(f"{path}/.github", ignore_errors=True)


if __name__ == "__main__":
Expand Down

0 comments on commit d4afa4d

Please sign in to comment.