[pypy-svn] r38692 - pypy/dist/pypy

pedronis at codespeak.net pedronis at codespeak.net
Tue Feb 13 14:22:42 CET 2007


Author: pedronis
Date: Tue Feb 13 14:22:40 2007
New Revision: 38692

Modified:
   pypy/dist/pypy/conftest.py
Log:
we need to be more subtle here for runappdirect. the internal names used by the options
don't match the import name, use the translation_info instead of an import to check for presence.
If translation_info is not there (CPython case) assume all modules are there, this is mostly
useful for py.test -A runs for comparison purposes, it may be wrong for some pypy specific modules.



Modified: pypy/dist/pypy/conftest.py
==============================================================================
--- pypy/dist/pypy/conftest.py	(original)
+++ pypy/dist/pypy/conftest.py	Tue Feb 13 14:22:40 2007
@@ -65,18 +65,20 @@
 class TinyObjSpace(object):
     def __init__(self, **kwds):
         import sys
+        info = getattr(sys, 'pypy_translation_info', None)
         for key, value in kwds.iteritems():
             if key == 'usemodules':
-                for modname in value:
-                    try:
-                        __import__(modname)
-                    except ImportError:
-                        py.test.skip("cannot runappdirect test: "
-                                     "module %r required" % (modname,))
+                if info is not None:
+                    for modname in value:
+                        ok = info.get('objspace.usemodules.%s' % modname,
+                                      False)
+                        if not ok:
+                            py.test.skip("cannot runappdirect test: "
+                                         "module %r required" % (modname,))
                 continue
-            if not hasattr(sys, 'pypy_translation_info'):
+            if info is None:
                 py.test.skip("cannot runappdirect this test on top of CPython")
-            has = sys.pypy_translation_info.get(key, None)
+            has = info.get(key, None)
             if has != value:
                 #print sys.pypy_translation_info
                 py.test.skip("cannot runappdirect test: space needs %s = %s, "\



More information about the Pypy-commit mailing list