File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -1795,8 +1795,15 @@ def test_commandresult_falsy(commandresult_app):
17951795
17961796def test_is_text_file_bad_input (base_app ):
17971797 # Test with a non-existent file - on GitHub Actions Windows test runners, we get a PermissionError
1798- with pytest .raises ((FileNotFoundError , PermissionError )):
1799- utils .is_text_file ('does_not_exist.txt' )
1798+ file_name = 'does_not_exist.txt'
1799+ if sys .platform .startswith ('win' ):
1800+ # For Windows, depending on setup you might get a FileNotFoundError or a PermissionError
1801+ with pytest .raises (OSError ): # noqa: PT011
1802+ utils .is_text_file (file_name )
1803+ else :
1804+ # For Linux or macOS you should reliably get a FileNotFoundError
1805+ with pytest .raises (FileNotFoundError ):
1806+ utils .is_text_file (file_name )
18001807
18011808 # Test with a directory
18021809 with pytest .raises (IsADirectoryError ):
You can’t perform that action at this time.
0 commit comments