Skip to content

Commit

Permalink
Change path type to str in fs utils remove command and fix for '*' at…
Browse files Browse the repository at this point in the history
… the

end of given path

Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
  • Loading branch information
Katarzyna Treder authored and katlapinka committed Sep 13, 2024
1 parent 96d7241 commit 452000c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test_tools/fs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,12 @@ def move(source, destination, force: bool = False):
return TestRun.executor.run_expect_success(cmd)


def remove(path, force: bool = False, recursive: bool = False, ignore_errors: bool = False):
cmd = f"rm{' --force' if force else ''}{' --recursive' if recursive else ''} \"{path}\""
def remove(path: str, force: bool = False, recursive: bool = False, ignore_errors: bool = False):
cmd = "rm"
cmd += " --force" if force else ""
cmd += " --recursive" if recursive else ""
cmd += f" \"{path}\"" if not path.endswith("*") else f" \"{path[:-1]}\"*"

output = TestRun.executor.run(cmd)
if output.exit_code != 0 and not ignore_errors:
raise Exception(f"Could not remove file {path}."
Expand Down

0 comments on commit 452000c

Please sign in to comment.