Commits

Armin Rigo committed 6d4ae65

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

Comments (0)

Files changed (1)

pypy/module/test_lib_pypy/test_distributed/test_distributed.py

     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)
         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
 
         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()
                 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
         
         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
                 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
         #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()
         def raising():
             1/0
         
-        protocol = self.test_env({'raising':raising})
+        protocol = self.test_env_[0]({'raising':raising})
         xr = protocol.get_remote('raising')
         try:
             xr()
                 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
                 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)
             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()
         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
 
         x = X()
 
-        protocol = self.test_env({'x':x})
+        protocol = self.test_env_[0]({'x':x})
         xx = protocol.get_remote('x')
         assert xx.x == 3
     
             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']