[pypy-svn] r25279 - in pypy/dist/pypy/objspace/flow: . test

tismer at codespeak.net tismer at codespeak.net
Tue Apr 4 07:19:53 CEST 2006


Author: tismer
Date: Tue Apr  4 07:19:50 2006
New Revision: 25279

Modified:
   pypy/dist/pypy/objspace/flow/objspace.py
   pypy/dist/pypy/objspace/flow/test/test_objspace.py
Log:
do_imports_immediately support is broken.
needed to re-enable AttributeError and ImportError for flow space.
Maybe there is a better solution, then let me know.
I'm wondering why geninterp is still working...


Modified: pypy/dist/pypy/objspace/flow/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/objspace.py	(original)
+++ pypy/dist/pypy/objspace/flow/objspace.py	Tue Apr  4 07:19:50 2006
@@ -49,7 +49,7 @@
         self.w_tuple    = Constant(tuple)
         self.concrete_mode = 0
         for exc in [KeyError, ValueError, IndexError, StopIteration,
-                    AssertionError, TypeError]:
+                    AssertionError, TypeError, AttributeError, ImportError]:
             clsname = exc.__name__
             setattr(self, 'w_'+clsname, Constant(exc))
         # the following exceptions are the ones that should not show up

Modified: pypy/dist/pypy/objspace/flow/test/test_objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/test/test_objspace.py	(original)
+++ pypy/dist/pypy/objspace/flow/test/test_objspace.py	Tue Apr  4 07:19:50 2006
@@ -636,6 +636,26 @@
         assert not call_args
         
 
+class TestFlowObjSpaceDelay:
+    def setup_class(cls): 
+        cls.space = FlowObjSpace()
+        cls.space.do_imports_immediately = False
+
+    def codetest(self, func):
+        import inspect
+        try:
+            func = func.im_func
+        except AttributeError:
+            pass
+        #name = func.func_name
+        graph = self.space.build_flow(func)
+        graph.source = inspect.getsource(func)
+        return graph
+
+    def test_import_something(self):
+        def f():
+            from some.unknown.module import stuff
+        self.codetest(f)
 
 DATA = {'x': 5,
         'y': 6}



More information about the Pypy-commit mailing list