diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 472fb0a2..1b9e60b7 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -42,4 +42,4 @@ jobs: - name: Run pytest run: | - poetry run pytest -s -vv -l + poetry run pytest -s -vv -l tests/test_late_interaction_embeddings.py diff --git a/tests/utils.py b/tests/utils.py index b19b0b56..2694ae03 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -15,9 +15,30 @@ def delete_model_cache(model_dir: Union[str, Path]) -> None: Args: model_dir (Union[str, Path]): The path to the model cache directory. """ + import os + + def recursive_chmod(path: str, mode: int): + """ + Recursively change permissions of files and directories. + + :param path: Path to the file or directory. + :param mode: File mode (e.g., 0o755). + """ + # Change the permission of the current path + print("change permission", path, mode) + os.chmod(path, mode) + + # If the path is a directory, recursively apply chmod to its contents + if os.path.isdir(path): + for entry in os.listdir(path): + full_path = os.path.join(path, entry) + recursive_chmod(full_path, mode) def on_error(func, path, exc_info): exc_type, exc_value, exc_traceback = exc_info + # Example usage: + # Change permissions to 755 recursively for a directory + recursive_chmod(path, 0o755) print("Failed to remove: ", path) print("Exception: ", exc_value) print("Traceback: ", traceback.format_tb(exc_traceback))