[pypy-svn] pypy default: Attempt to fix the test on pypy-c-stackless.

arigo commits-noreply at bitbucket.org
Wed Mar 16 14:45:56 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r42712:6d4ae655b397
Date: 2011-03-16 09:45 -0400
http://bitbucket.org/pypy/pypy/changeset/6d4ae655b397/

Log:	Attempt to fix the test on pypy-c-stackless.

diff --git a/pypy/module/test_lib_pypy/test_distributed/test_distributed.py b/pypy/module/test_lib_pypy/test_distributed/test_distributed.py
--- a/pypy/module/test_lib_pypy/test_distributed/test_distributed.py
+++ b/pypy/module/test_lib_pypy/test_distributed/test_distributed.py
@@ -94,9 +94,9 @@
     def setup_class(cls):
         #cls.space = gettestobjspace(**{"objspace.std.withtproxy": True,
         #    "usemodules":("_stackless",)})
-        cls.w_test_env = cls.space.appexec([], """():
+        cls.w_test_env_ = cls.space.appexec([], """():
         from distributed import test_env
-        return test_env
+        return (test_env,)
         """)
         cls.reclimit = sys.getrecursionlimit()
         sys.setrecursionlimit(100000)
@@ -108,7 +108,7 @@
         def f(x, y):
             return x + y
         
-        protocol = self.test_env({"f": f})
+        protocol = self.test_env_[0]({"f": f})
         fun = protocol.get_remote("f")
         assert fun(2, 3) == 5
 
@@ -119,14 +119,14 @@
         def f(x):
             return x + g()
         
-        protocol = self.test_env({"f":f})
+        protocol = self.test_env_[0]({"f":f})
         fun = protocol.get_remote("f")
         assert fun(8) == 16
     
     def test_remote_dict(self):
         #skip("Land of infinite recursion")
         d = {'a':3}
-        protocol = self.test_env({'d':d})
+        protocol = self.test_env_[0]({'d':d})
         xd = protocol.get_remote('d')
         #assert d['a'] == xd['a']
         assert d.keys() == xd.keys()
@@ -142,7 +142,7 @@
                 return self.x + 8
         a = A(3)
         
-        protocol = self.test_env({'a':a})
+        protocol = self.test_env_[0]({'a':a})
         xa = protocol.get_remote("a")
         assert xa.x == 3
         assert len(xa) == 11
@@ -161,7 +161,7 @@
         
         a = A()
         
-        protocol = self.test_env({'a':a})
+        protocol = self.test_env_[0]({'a':a})
         xa = protocol.get_remote('a')
         assert xa.__class__.__doc__ == 'xxx'
         assert xa.meth(x) == 4
@@ -179,7 +179,7 @@
                 return [1,2,3]
         
         a = A()
-        protocol = self.test_env({'a': a})
+        protocol = self.test_env_[0]({'a': a})
         xa = protocol.get_remote('a')
         xa.meth(B())
         assert xa.perform() == 4
@@ -188,7 +188,7 @@
         #skip("Land of infinite recursion")
         import sys
         f = sys._getframe()
-        protocol = self.test_env({'f':f})
+        protocol = self.test_env_[0]({'f':f})
         xf = protocol.get_remote('f')
         assert f.f_globals.keys() == xf.f_globals.keys()
         assert f.f_locals.keys() == xf.f_locals.keys()
@@ -197,7 +197,7 @@
         def raising():
             1/0
         
-        protocol = self.test_env({'raising':raising})
+        protocol = self.test_env_[0]({'raising':raising})
         xr = protocol.get_remote('raising')
         try:
             xr()
@@ -217,7 +217,7 @@
                 return cls.z
 
         a = A()
-        protocol = self.test_env({'a':a})
+        protocol = self.test_env_[0]({'a':a})
         xa = protocol.get_remote("a")
         res = xa.x()
         assert res == 8
@@ -228,7 +228,7 @@
                 assert type(self) is tp
 
         a = A()
-        protocol = self.test_env({'a':a, 'A':A})
+        protocol = self.test_env_[0]({'a':a, 'A':A})
         xa = protocol.get_remote('a')
         xA = protocol.get_remote('A')
         xa.m(xA)
@@ -241,7 +241,7 @@
             def x(self):
                 return self.y
 
-        protocol = self.test_env({'C':C})
+        protocol = self.test_env_[0]({'C':C})
         xC = protocol.get_remote('C')
         xc = xC(3)
         res = xc.x()
@@ -251,14 +251,14 @@
         skip("Fix me some day maybe")
         import sys
 
-        protocol = self.test_env({'sys':sys})
+        protocol = self.test_env_[0]({'sys':sys})
         s = protocol.get_remote('sys')
         l = dir(s)
         assert l
 
     def test_remote_file_access(self):
         skip("Descriptor logic seems broken")
-        protocol = self.test_env({'f':open})
+        protocol = self.test_env_[0]({'f':open})
         xf = protocol.get_remote('f')
         data = xf('/etc/passwd').read()
         assert data
@@ -275,7 +275,7 @@
 
         x = X()
 
-        protocol = self.test_env({'x':x})
+        protocol = self.test_env_[0]({'x':x})
         xx = protocol.get_remote('x')
         assert xx.x == 3
     
@@ -287,17 +287,17 @@
             pass
 
         y = Y()
-        protocol = self.test_env({'y':y, 'X':X})
+        protocol = self.test_env_[0]({'y':y, 'X':X})
         xy = protocol.get_remote('y')
         xX = protocol.get_remote('X')
         assert isinstance(xy, xX)
 
     def test_key_error(self):
         from distributed import ObjectNotFound
-        protocol = self.test_env({})
+        protocol = self.test_env_[0]({})
         raises(ObjectNotFound, "protocol.get_remote('x')")
 
     def test_list_items(self):
-        protocol = self.test_env({'x':3, 'y':8})
+        protocol = self.test_env_[0]({'x':3, 'y':8})
         assert sorted(protocol.remote_keys()) == ['x', 'y']
 


More information about the Pypy-commit mailing list