https://github.com/python/cpython/commit/bf6c74dc7ab5ee3cc537a5082a75f4387ad64eeb
commit: bf6c74dc7ab5ee3cc537a5082a75f4387ad64eeb
branch: 3.13
author: Serhiy Storchaka <storch...@gmail.com>
committer: serhiy-storchaka <storch...@gmail.com>
date: 2025-04-24T18:47:01+03:00
summary:

[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.

files:
M Lib/test/test_ioctl.py

diff --git a/Lib/test/test_ioctl.py b/Lib/test/test_ioctl.py
index cc625812dc3d03..17170a8120244a 100644
--- a/Lib/test/test_ioctl.py
+++ b/Lib/test/test_ioctl.py
@@ -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)
 

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to