[pypy-svn] r49881 - pypy/dist/pypy/translator/goal/test2

exarkun at codespeak.net exarkun at codespeak.net
Tue Dec 18 00:02:38 CET 2007


Author: exarkun
Date: Tue Dec 18 00:02:38 2007
New Revision: 49881

Modified:
   pypy/dist/pypy/translator/goal/test2/test_app_main.py
Log:
skip the pexpect-using app_main tests if the available version of pexpect is older than 2.1

Versions of pexpect older than 2.1 seem to have problems with py.io which
leads to AttributeErrors.


Modified: pypy/dist/pypy/translator/goal/test2/test_app_main.py
==============================================================================
--- pypy/dist/pypy/translator/goal/test2/test_app_main.py	(original)
+++ pypy/dist/pypy/translator/goal/test2/test_app_main.py	Tue Dec 18 00:02:38 2007
@@ -63,6 +63,21 @@
             import pexpect
         except ImportError, e:
             py.test.skip(str(e))
+        else:
+            # Version is of the style "0.999" or "2.1".  Older versions of
+            # pexpect try to get the fileno of stdin, which generally won't
+            # work with py.test (due to sys.stdin being a DontReadFromInput
+            # instance).
+            version = map(int, pexpect.__version__.split('.'))
+
+            # I only tested 0.999 and 2.1.  The former does not work, the
+            # latter does.  Feel free to refine this measurement.
+            # -exarkun, 17/12/2007
+            if version < [2, 1]:
+                py.test.skip(
+                    "pexpect version too old, requires 2.1 or newer: %r" % (
+                        pexpect.__version__,))
+
         kwds.setdefault('timeout', 10)
         print 'SPAWN:', args, kwds
         child = pexpect.spawn(*args, **kwds)



More information about the Pypy-commit mailing list