Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
joein committed Nov 11, 2024
1 parent f1b9176 commit e6471fd
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import shutil
import traceback

from pathlib import Path
from typing import Union
Expand All @@ -16,15 +17,10 @@ def delete_model_cache(model_dir: Union[str, Path]) -> None:
"""

def on_error(func, path, exc_info):
import stat
import os

# Is the error an access error?
if not os.access(path, os.W_OK):
os.chmod(path, stat.S_IWUSR)
func(path)
else:
raise
exc_type, exc_value, exc_traceback = exc_info
print("Failed to remove: ", path)
print("Exception: ", exc_value)
print("Traceback: ", traceback.format_tb(exc_traceback))

if isinstance(model_dir, str):
model_dir = Path(model_dir)
Expand Down

0 comments on commit e6471fd

Please sign in to comment.