mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
gh-43414: os.get_terminal_size() now uses the actual file descriptor on Windows instead of mapping to standard handles (#93203)
This commit is contained in:
parent
390847922c
commit
edb72047f3
3 changed files with 17 additions and 15 deletions
|
@ -3665,6 +3665,19 @@ class TermsizeTests(unittest.TestCase):
|
|||
raise
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
@unittest.skipUnless(sys.platform == 'win32', 'Windows specific test')
|
||||
def test_windows_fd(self):
|
||||
"""Check if get_terminal_size() returns a meaningful value in Windows"""
|
||||
try:
|
||||
conout = open('conout$', 'w')
|
||||
except OSError:
|
||||
self.skipTest('failed to open conout$')
|
||||
with conout:
|
||||
size = os.get_terminal_size(conout.fileno())
|
||||
|
||||
self.assertGreaterEqual(size.columns, 0)
|
||||
self.assertGreaterEqual(size.lines, 0)
|
||||
|
||||
|
||||
@unittest.skipUnless(hasattr(os, 'memfd_create'), 'requires os.memfd_create')
|
||||
@support.requires_linux_version(3, 17)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue