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):
1795
1795
1796
1796
def test_is_text_file_bad_input (base_app ):
1797
1797
# 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 )
1800
1807
1801
1808
# Test with a directory
1802
1809
with pytest .raises (IsADirectoryError ):
You can’t perform that action at this time.
0 commit comments