[pypy-svn] r41258 - pypy/dist/pypy

arigo at codespeak.net arigo at codespeak.net
Sat Mar 24 20:38:37 CET 2007


Author: arigo
Date: Sat Mar 24 20:38:35 2007
New Revision: 41258

Modified:
   pypy/dist/pypy/conftest.py
Log:
(pedronis, arigo)
Add a helper to build a space without caching it.
Forgotten in the previous check-in.


Modified: pypy/dist/pypy/conftest.py
==============================================================================
--- pypy/dist/pypy/conftest.py	(original)
+++ pypy/dist/pypy/conftest.py	Sat Mar 24 20:38:35 2007
@@ -43,26 +43,32 @@
                     py.test.skip("cannot runappdirect test: "
                                  "%s objspace required" % (name,))
             return TinyObjSpace(**kwds)
-        try:
-            space = make_objspace(config)
-        except OperationError, e:
-            check_keyboard_interrupt(e)
-            if option.verbose:
-                import traceback
-                traceback.print_exc()
-            py.test.fail("fatal: cannot initialize objspace: %r" %
-                             (config.objspace.name,))
+        space = maketestobjspace(config)
         _SPACECACHE[key] = space
-        space.setitem(space.builtin.w_dict, space.wrap('AssertionError'),
-                      appsupport.build_pytest_assertion(space))
-        space.setitem(space.builtin.w_dict, space.wrap('raises'),
-                      space.wrap(appsupport.app_raises))
-        space.setitem(space.builtin.w_dict, space.wrap('skip'),
-                      space.wrap(appsupport.app_skip))
-        space.raises_w = appsupport.raises_w.__get__(space)
-        space.eq_w = appsupport.eq_w.__get__(space)
         return space
 
+def maketestobjspace(config=None):
+    if config is None:
+        config = make_config(option)
+    try:
+        space = make_objspace(config)
+    except OperationError, e:
+        check_keyboard_interrupt(e)
+        if option.verbose:
+            import traceback
+            traceback.print_exc()
+        py.test.fail("fatal: cannot initialize objspace: %r" %
+                         (config.objspace.name,))
+    space.setitem(space.builtin.w_dict, space.wrap('AssertionError'),
+                  appsupport.build_pytest_assertion(space))
+    space.setitem(space.builtin.w_dict, space.wrap('raises'),
+                  space.wrap(appsupport.app_raises))
+    space.setitem(space.builtin.w_dict, space.wrap('skip'),
+                  space.wrap(appsupport.app_skip))
+    space.raises_w = appsupport.raises_w.__get__(space)
+    space.eq_w = appsupport.eq_w.__get__(space)
+    return space
+
 class TinyObjSpace(object):
     def __init__(self, **kwds):
         import sys



More information about the Pypy-commit mailing list