[Python-checkins] r52547 - python/trunk/Lib/test/test_openpty.py

georg.brandl python-checkins at python.org
Sun Oct 29 22:54:19 CET 2006


Author: georg.brandl
Date: Sun Oct 29 22:54:18 2006
New Revision: 52547

Modified:
   python/trunk/Lib/test/test_openpty.py
Log:
Move the check for openpty to the beginning.



Modified: python/trunk/Lib/test/test_openpty.py
==============================================================================
--- python/trunk/Lib/test/test_openpty.py	(original)
+++ python/trunk/Lib/test/test_openpty.py	Sun Oct 29 22:54:18 2006
@@ -3,13 +3,13 @@
 import os, unittest
 from test.test_support import run_unittest, TestSkipped
 
+if not hasattr(os, "openpty"):
+    raise TestSkipped, "No openpty() available."
+
+
 class OpenptyTest(unittest.TestCase):
     def test(self):
-        try:
-            master, slave = os.openpty()
-        except AttributeError:
-            raise TestSkipped, "No openpty() available."
-
+        master, slave = os.openpty()
         if not os.isatty(slave):
             self.fail("Slave-end of pty is not a terminal.")
 


More information about the Python-checkins mailing list