8000 [3.13] Use os.openpty() instead of pty.openpty() in test_ioctl (GH-13… · python/cpython@bf6c74d · GitHub
[go: up one dir, main page]

Skip to content

Commit bf6c74d

Browse files
[3.13] Use os.openpty() instead of pty.openpty() in test_ioctl (GH-132878)
pty.openpty() does not work on Android, and it is easier to check availability of os.openpty.
1 parent 52e0f56 commit bf6c74d

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Lib/test/test_ioctl.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99
fcntl = import_module('fcntl')
1010
termios = import_module('termios')
1111

12-
try:
13-
import pty
14-
except ImportError:
15-
pty = None
16-
1712
class IoctlTestsTty(unittest.TestCase):
1813
@classmethod
1914
def setUpClass(cls):
@@ -136,10 +131,10 @@ def test_ioctl_mutate_2048(self):
136131
self.assertRaises(ValueError, self._check_ioctl_not_mutate_len, 2048)
137132

138133

139-
@unittest.skipIf(pty is None, 'pty module required')
134+
@unittest.skipUnless(hasattr(os, 'openpty'), "need os.openpty()")
140135
class IoctlTestsPty(unittest.TestCase):
141136
def setUp(self):
142-
self.master_fd, self.slave_fd = pty.openpty()
137+
self.master_fd, self.slave_fd = os.openpty()
143138
self.addCleanup(os.close, self.slave_fd)
144139
self.addCleanup(os.close, self.master_fd)
145140

0 commit comments

Comments
 (0)
0