[Python-checkins] r42197 - python/trunk/Lib/test/test_pty.py

thomas.wouters python-checkins at python.org
Sat Jan 28 13:05:54 CET 2006


Author: thomas.wouters
Date: Sat Jan 28 13:05:54 2006
New Revision: 42197

Modified:
   python/trunk/Lib/test/test_pty.py
Log:

Work around a Solaris peculiarity that caused test_pty to sometimes fail: a
tty opened by os.openpty() isn't always a tty according to os.isatty(), when
it's tested inside the process that opened it. Doesn't affect actual
functionality, as using a tty this way is rarely, if ever, useful. Ignoring
the failure allows the test for actual functionality to continue.

Will backport to 2.4-maint.



Modified: python/trunk/Lib/test/test_pty.py
==============================================================================
--- python/trunk/Lib/test/test_pty.py	(original)
+++ python/trunk/Lib/test/test_pty.py	Sat Jan 28 13:05:54 2006
@@ -4,6 +4,13 @@
 TEST_STRING_1 = "I wish to buy a fish license.\n"
 TEST_STRING_2 = "For my pet fish, Eric.\n"
 
+# Solaris (at least 2.9 and 2.10) seem to have a ficke isatty(). The first
+# test below, testing the result of os.openpty() for tty-ness, sometimes
+# (but not always) fails. The second isatty test, in the sub-process, always
+# works. Allow that fickle first test to fail on these platforms, since it
+# doesn't actually affect functionality.
+fickle_isatty = ["sunos5"]
+
 if verbose:
     def debug(msg):
         print msg
@@ -26,7 +33,7 @@
         # " An optional feature could not be imported " ... ?
         raise TestSkipped, "Pseudo-terminals (seemingly) not functional."
 
-    if not os.isatty(slave_fd):
+    if not os.isatty(slave_fd) and sys.platform not in fickle_isatty:
         raise TestFailed, "slave_fd is not a tty"
 
     # IRIX apparently turns \n into \r\n. Allow that, but avoid allowing other


More information about the Python-checkins mailing list