Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Accept EACCES when calling os.get_terminal_size on Android
  • Loading branch information
mhsmith committed Mar 27, 2024
commit 236e9d03d6f8b35d42c4672ae384f0db22c43d2e
7 changes: 6 additions & 1 deletion Lib/test/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -3931,7 +3931,12 @@ def test_does_not_crash(self):
try:
size = os.get_terminal_size()
except OSError as e:
if sys.platform == "win32" or e.errno in (errno.EINVAL, errno.ENOTTY):
known_errnos = [errno.EINVAL, errno.ENOTTY]
if sys.platform == "android":
# The Android testbed redirects the native stdout to a pipe,
# which returns a different error code.
known_errnos.append(errno.EACCES)
if (sys.platform == "win32") or (e.errno in known_errnos):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parentheses are not needed.

# Under win32 a generic OSError can be thrown if the
# handle cannot be retrieved
self.skipTest("failed to query terminal size")
Expand Down