[pypy-svn] r9279 - in pypy/branch/dist-interpapp/pypy/interpreter: . test

hpk at codespeak.net hpk at codespeak.net
Thu Feb 17 18:21:31 CET 2005


Author: hpk
Date: Thu Feb 17 18:21:31 2005
New Revision: 9279

Removed:
   pypy/branch/dist-interpapp/pypy/interpreter/test/foomodule.py
   pypy/branch/dist-interpapp/pypy/interpreter/test/test_extmodule.py
Modified:
   pypy/branch/dist-interpapp/pypy/interpreter/main.py
   pypy/branch/dist-interpapp/pypy/interpreter/test/test_main.py
   pypy/branch/dist-interpapp/pypy/interpreter/test/test_objspace.py
Log:
make interpreter-tests mostly pass  (test_py.py 
fails due to stdout-output which i don'T want
to comment out yet) 

get rid of test_extmodule and the accompanying 
foomodule.py because we will hopefully not see
the old way again :-) 



Modified: pypy/branch/dist-interpapp/pypy/interpreter/main.py
==============================================================================
--- pypy/branch/dist-interpapp/pypy/interpreter/main.py	(original)
+++ pypy/branch/dist-interpapp/pypy/interpreter/main.py	Thu Feb 17 18:21:31 2005
@@ -14,10 +14,10 @@
             from pypy.objspace.std import StdObjSpace
             space = StdObjSpace()
 
-        compile = space.builtin.compile
+        w_compile = space.builtin.get('compile') 
         w = space.wrap
-        w_code = compile(source, filename, cmd, 0, 0)
-
+        w_code = space.call_function(w_compile, 
+                 w(source), w(filename), w(cmd), w(0), w(0))
         mainmodule = module.Module(space, space.wrap("__main__"))
         w_globals = mainmodule.w_dict
 

Deleted: /pypy/branch/dist-interpapp/pypy/interpreter/test/foomodule.py
==============================================================================
--- /pypy/branch/dist-interpapp/pypy/interpreter/test/foomodule.py	Thu Feb 17 18:21:31 2005
+++ (empty file)
@@ -1,13 +0,0 @@
-
-__interplevel__exec("w_foo = space.w_Ellipsis")
-foo1 = __interplevel__eval("w_foo")  # foo1 is Ellipsis
-from __interplevel__ import foo      # Ellipsis too
-
-def bar(a, b):  # visible from interp-level code
-    return a * b
-
-__interplevel__execfile("foointerp.py")  # defines w_foo2 and foobuilder()
-
-from __interplevel__ import foo2   # from w_foo2, gives "hello"
-from __interplevel__ import foobuilder
-foo3 = foobuilder("guido")         # gives "hi, guido!"

Deleted: /pypy/branch/dist-interpapp/pypy/interpreter/test/test_extmodule.py
==============================================================================
--- /pypy/branch/dist-interpapp/pypy/interpreter/test/test_extmodule.py	Thu Feb 17 18:21:31 2005
+++ (empty file)
@@ -1,25 +0,0 @@
-
-import autopath
-import os
-from pypy.interpreter.extmodule import BuiltinModule
-
-class TestBuiltinModule: 
-    def test_foomodule(self):
-        space = self.space
-        sourcefile = os.path.join(autopath.this_dir, 'foomodule.py')
-        m = BuiltinModule(space, 'foo', sourcefile=sourcefile)
-        w = space.wrap
-        w_m = space.wrap(m)
-        assert self.space.eq_w(space.getattr(w_m, w('__name__')), w('foo'))
-        assert self.space.eq_w(space.getattr(w_m, w('__file__')), w(sourcefile))
-        # check app-level definitions
-        assert self.space.eq_w(m.w_foo, space.w_Ellipsis)
-        assert self.space.eq_w(space.getattr(w_m, w('foo1')), space.w_Ellipsis)
-        assert self.space.eq_w(space.getattr(w_m, w('foo')), space.w_Ellipsis)
-        assert self.space.eq_w(space.call_method(w_m, 'bar', w(4), w(3)), w(12))
-        assert self.space.eq_w(space.getattr(w_m, w('foo2')), w('hello'))
-        assert self.space.eq_w(space.getattr(w_m, w('foo3')), w('hi, guido!'))
-        # check interp-level definitions
-        assert self.space.eq_w(m.w_foo2, w('hello'))
-        assert self.space.eq_w(m.foobuilder(w('xyzzy')), w('hi, xyzzy!'))
-        assert self.space.eq_w(m.fortytwo, w(42))

Modified: pypy/branch/dist-interpapp/pypy/interpreter/test/test_main.py
==============================================================================
--- pypy/branch/dist-interpapp/pypy/interpreter/test/test_main.py	(original)
+++ pypy/branch/dist-interpapp/pypy/interpreter/test/test_main.py	Thu Feb 17 18:21:31 2005
@@ -17,7 +17,7 @@
 testresultoutput = '11\n'
 
 def checkoutput(space, expected_output,f,*args):
-    w_sys = space.get_builtin_module("sys")
+    w_sys = space.w_sys 
     w_oldout = space.getattr(w_sys, space.wrap("stdout"))
     capturefn = udir.join('capturefile')
     capturefile = capturefn.open('w') 

Modified: pypy/branch/dist-interpapp/pypy/interpreter/test/test_objspace.py
==============================================================================
--- pypy/branch/dist-interpapp/pypy/interpreter/test/test_objspace.py	(original)
+++ pypy/branch/dist-interpapp/pypy/interpreter/test/test_objspace.py	Thu Feb 17 18:21:31 2005
@@ -89,12 +89,12 @@
 
 class TestModuleMinimal: 
     def test_sys_exists(self):
-        w_sys = self.space.get_builtin_module('sys')
+        w_sys = self.space.w_sys 
         assert self.space.is_true(w_sys)
 
     def test_import_exists(self):
         space = self.space
-        w_builtin = space.get_builtin_module('__builtin__')
+        w_builtin = space.w_builtin 
         assert space.is_true(w_builtin)
         w_name = space.wrap('__import__')
         w_import = self.space.getattr(w_builtin, w_name)



More information about the Pypy-commit mailing list