Skip to content

Commit eafdb93

Browse files
Update nipype/utils/tests/test_filemanip.py
Handle mock test case when no `dir_fd` is passed
1 parent 05aa554 commit eafdb93

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

nipype/utils/tests/test_filemanip.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,12 @@ def test_write_rst_list(tmp_path, items, expected):
674674

675675

676676
def nfs_unlink(pathlike, *, dir_fd=None):
677-
os.rename(pathlike, ".nfs1111111111", src_dir_fd=dir_fd, dst_dir_fd=dir_fd)
677+
if dir_fd is None:
678+
path = Path(pathlike)
679+
deleted = path.with_name(".nfs00000000")
680+
path.rename(deleted)
681+
else:
682+
os.rename(pathlike, ".nfs1111111111", src_dir_fd=dir_fd, dst_dir_fd=dir_fd)
678683

679684

680685
def test_emptydirs_dangling_nfs(tmp_path):

0 commit comments

Comments
 (0)