@@ -549,13 +549,19 @@ def test_realpath_invalid_paths(self):
549549 self .assertRaises (UnicodeDecodeError , realpath , path , strict = True )
550550 else :
551551 self .assertEqual (realpath (path , strict = False ), path )
552- self .assertRaises (FileNotFoundError , realpath , path , strict = True )
552+ if support .is_wasi :
553+ self .assertRaises (FileNotFoundError , realpath , path , strict = True )
554+ else :
555+ self .assertRaises (OSError , realpath , path , strict = True )
553556 path = b'/nonexistent/\xff '
554557 if sys .platform == 'win32' :
555558 self .assertRaises (UnicodeDecodeError , realpath , path , strict = False )
556559 else :
557560 self .assertEqual (realpath (path , strict = False ), path )
558- self .assertRaises (FileNotFoundError , realpath , path , strict = True )
561+ if support .is_wasi :
562+ self .assertRaises (FileNotFoundError , realpath , path , strict = True )
563+ else :
564+ self .assertRaises (OSError , realpath , path , strict = True )
559565
560566 @os_helper .skip_unless_symlink
561567 @skip_if_ABSTFN_contains_backslash
0 commit comments