File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ The released versions correspond to PyPI releases.
1717
1818## Fixes
1919* fixes patching of Debian-specific `tempfile` in Python 3.13 (see [#1214](../../issues/1214))
20- * adapted some error codes for `OSError` to match Windows 11 behavior
20+ * adapted some error codes for `OSError` to match Windows 11/Windows Server 2025 behavior
2121
2222## [Version 5.9.3](https://pypi.python.org/pypi/pyfakefs/5.9.3) (2025-08-28)
2323Fixes a utility method.
Original file line number Diff line number Diff line change @@ -2003,7 +2003,7 @@ def rename(
20032003 self .raise_os_error (errno .EXDEV , old_path )
20042004 if not S_ISDIR (new_dir_object .st_mode ):
20052005 self .raise_os_error (
2006- errno .EACCES if self .is_windows_fs else errno .ENOTDIR , new_path
2006+ errno .EINVAL if self .is_windows_fs else errno .ENOTDIR , new_path
20072007 )
20082008 if new_dir_object .has_parent_object (old_object ):
20092009 self .raise_os_error (errno .EINVAL , new_path )
@@ -2073,7 +2073,7 @@ def _rename_to_existing_path(
20732073 new_object = self ._get_object (new_file_path )
20742074 if old_file_path == new_file_path :
20752075 if not S_ISLNK (new_object .st_mode ) and ends_with_sep :
2076- error = errno .EINVAL if self .is_windows_fs else errno .ENOTDIR
2076+ error = errno .ENOTDIR if self .is_windows_fs else errno .ENOTDIR
20772077 self .raise_os_error (error , old_file_path )
20782078 return None # Nothing to do here
20792079
@@ -3113,7 +3113,9 @@ def remove(self, path: AnyStr) -> None:
31133113 self .raise_os_error (error , norm_path )
31143114
31153115 if path .endswith (self .get_path_separator (path )):
3116- if self .is_macos :
3116+ if self .is_windows_fs :
3117+ error = errno .EACCES
3118+ elif self .is_macos :
31173119 error = errno .EPERM
31183120 else :
31193121 error = errno .ENOTDIR
You can’t perform that action at this time.
0 commit comments