mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
Use os.openpty() instead of pty.openpty() in test_ioctl (GH-132880)
pty.openpty() does not work on Android, and it is easier to check availability of os.openpty.
This commit is contained in:
parent
bab59a904c
commit
8c975b0fdd
1 changed files with 2 additions and 7 deletions
|
|
@ -9,11 +9,6 @@
|
|||
fcntl = import_module('fcntl')
|
||||
termios = import_module('termios')
|
||||
|
||||
try:
|
||||
import pty
|
||||
except ImportError:
|
||||
pty = None
|
||||
|
||||
class IoctlTestsTty(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
|
@ -136,10 +131,10 @@ def test_ioctl_mutate_2048(self):
|
|||
self.assertRaises(ValueError, self._check_ioctl_not_mutate_len, 2048)
|
||||
|
||||
|
||||
@unittest.skipIf(pty is None, 'pty module required')
|
||||
@unittest.skipUnless(hasattr(os, 'openpty'), "need os.openpty()")
|
||||
class IoctlTestsPty(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.master_fd, self.slave_fd = pty.openpty()
|
||||
self.master_fd, self.slave_fd = os.openpty()
|
||||
self.addCleanup(os.close, self.slave_fd)
|
||||
self.addCleanup(os.close, self.master_fd)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue