]> granicus.if.org Git - python/commitdiff
Move the check for openpty to the beginning.
authorGeorg Brandl <georg@python.org>
Sun, 29 Oct 2006 21:54:18 +0000 (21:54 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 29 Oct 2006 21:54:18 +0000 (21:54 +0000)
Lib/test/test_openpty.py

index f770af617b19f23084e413f8f9322a7de93c3473..6471f58ce514b6b501bab8e72eac40e4dcdc4633 100644 (file)
@@ -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.")