@@ -115,11 +115,16 @@ def test_ro_file(lock_type: type[BaseFileLock], tmp_file_ro: Path) -> None:
115115 pytest .param (FileNotFoundError , "No such file or directory:" , "a/b" , id = "non_existent_directory" ),
116116 pytest .param (FileNotFoundError , "No such file or directory:" , "" , id = "blank_filename" ),
117117 pytest .param (ValueError , "embedded null (byte|character)" , "\0 " , id = "null_byte" ),
118- pytest .param (
119- PermissionError if sys .platform == "win32" else IsADirectoryError ,
120- "Permission denied:" if sys .platform == "win32" else "Is a directory" ,
121- "." ,
122- id = "current_directory" ,
118+ # Should be PermissionError on Windows
119+ pytest .param (PermissionError , "Permission denied:" , "." , id = "current_directory" )
120+ if sys .platform == "win32"
121+ else (
122+ # Should be IsADirectoryError on MacOS and Linux
123+ pytest .param (IsADirectoryError , "Is a directory" , "." , id = "current_directory" )
124+ if sys .platform in ["darwin" , "linux" ]
125+ else
126+ # Should be some type of OSError at least on other operating systems
127+ pytest .param (OSError , None , "." , id = "current_directory" )
123128 ),
124129 ]
125130 + [pytest .param (OSError , "Invalid argument" , i , id = f"invalid_{ i } " , marks = WindowsOnly ) for i in '<>:"|?*\a ' ]
0 commit comments