huggingface_hub
47fc2936 - Fix tests involving temp directory on macOS (#2052)

Commit
1 year ago
Fix tests involving temp directory on macOS (#2052) * Fixed typos * Always resolve the path to a temp file The problem is that the code trying to create a symlink in `_create_symlink` tries to find a relative path from src to dst in ``` relative_src = os.path.relpath(abs_src, abs_dst_folder) ``` The problem is that on macOS, abs_src and abs_dst have a different root path due to the way the OS handles temp directories. The one from the fixture is a resolved path to `/private/var/folders/…` while the one from `SoftTemporaryDirectory` is still an unresolved path pointing to `/var/folders/` (`/var/` is actually `var -> private/var`). And thus, their common ancestor is `/` which we try use to write the symlink to (which obviously fails). Removed resolving the path from the fixture and instead resolve the path all the time in `SoftTemporaryDirectory` (which is used by the fixture) so all call sites get the same resolved path. * Fix usages of SoftTemporaryDirectory * Fix import
Author
Parents
Loading