@@ -1118,8 +1118,9 @@ def _auto_mount_drive_if_needed(self, path: AnyStr,
11181118
11191119 def _mount_point_for_path (self , path : AnyStr ) -> Dict :
11201120 path = self .absnormpath (self ._original_path (path ))
1121- if path in self .mount_points :
1122- return self .mount_points [path ]
1121+ for mount_path in self .mount_points :
1122+ if path == matching_string (path , mount_path ):
1123+ return self .mount_points [mount_path ]
11231124 mount_path = matching_string (path , '' )
11241125 drive = self .splitdrive (path )[0 ]
11251126 for root_path in self .mount_points :
@@ -2048,9 +2049,9 @@ def get_object_from_normpath(self,
20482049 OSError: if the object is not found.
20492050 """
20502051 path = make_string_path (file_path )
2051- if path == self .root .name :
2052+ if path == matching_string ( path , self .root .name ) :
20522053 return self .root
2053- if path == self .dev_null .name :
2054+ if path == matching_string ( path , self .dev_null .name ) :
20542055 return self .dev_null
20552056
20562057 path = self ._original_path (path )
@@ -2143,7 +2144,7 @@ def lresolve(self, path: AnyPath) -> FakeFile:
21432144 path_str = make_string_path (path )
21442145 if not path_str :
21452146 raise OSError (errno .ENOENT , path_str )
2146- if path_str == self .root .name :
2147+ if path_str == matching_string ( path_str , self .root .name ) :
21472148 # The root directory will never be a link
21482149 return self .root
21492150
@@ -3201,7 +3202,7 @@ def rmdir(self, target_directory: AnyStr,
32013202 OSError: if removal failed per FakeFilesystem.RemoveObject.
32023203 Cannot remove '.'.
32033204 """
3204- if target_directory in ( b'.' , u '.' ):
3205+ if target_directory == matching_string ( target_directory , '.' ):
32053206 error_nr = errno .EACCES if self .is_windows_fs else errno .EINVAL
32063207 self .raise_os_error (error_nr , target_directory )
32073208 ends_with_sep = self .ends_with_path_separator (target_directory )
@@ -4652,7 +4653,7 @@ def mknod(self, path: AnyStr, mode: Optional[int] = None,
46524653 if self .filesystem .exists (head , check_link = True ):
46534654 self .filesystem .raise_os_error (errno .EEXIST , path )
46544655 self .filesystem .raise_os_error (errno .ENOENT , path )
4655- if tail in (b'.' , u '.', b'..' , u '..' ):
4656+ if tail in (matching_string ( tail , '.' ), matching_string ( tail , '..' ) ):
46564657 self .filesystem .raise_os_error (errno .ENOENT , path )
46574658 if self .filesystem .exists (path , check_link = True ):
46584659 self .filesystem .raise_os_error (errno .EEXIST , path )
0 commit comments