Skip to content

Commit c54c9ea

Browse files
committed
Allow two different types of exceptions for one test since windows test runners have a different one
1 parent 05dc6fb commit c54c9ea

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

tests/test_cmd2.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import builtins
66
import io
77
import os
8-
import pathlib
98
import signal
109
import sys
1110
import tempfile
@@ -1795,12 +1794,9 @@ def test_commandresult_falsy(commandresult_app):
17951794

17961795

17971796
def test_is_text_file_bad_input(base_app):
1798-
# Test with a non-existent file
1799-
home_dir = pathlib.Path.home()
1800-
file_path = home_dir / 'does_not_exist'
1801-
file_str = f'{file_path}'
1802-
with pytest.raises(FileNotFoundError):
1803-
utils.is_text_file(file_str)
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')
18041800

18051801
# Test with a directory
18061802
with pytest.raises(IsADirectoryError):

0 commit comments

Comments
 (0)