[pypy-svn] r40757 - pypy/dist/pypy/lib/distributed/test

fijal at codespeak.net fijal at codespeak.net
Mon Mar 19 12:01:46 CET 2007


Author: fijal
Date: Mon Mar 19 12:01:43 2007
New Revision: 40757

Modified:
   pypy/dist/pypy/lib/distributed/test/test_greensock.py
Log:
Make this a bit aware of location of pylib


Modified: pypy/dist/pypy/lib/distributed/test/test_greensock.py
==============================================================================
--- pypy/dist/pypy/lib/distributed/test/test_greensock.py	(original)
+++ pypy/dist/pypy/lib/distributed/test/test_greensock.py	Mon Mar 19 12:01:43 2007
@@ -7,36 +7,38 @@
         cls.space = gettestobjspace(**{"objspace.std.withtproxy": True,
                                        "usemodules":("_stackless",)})
         cls.w_remote_side_code = cls.space.appexec([], """():
-        import py
-        remote_side_code = str(py.code.Source('''
-        class A:
-            def __init__(self, x):
-                self.x = x
+        import sys
+        sys.path.insert(0, '%s')
+        remote_side_code = '''
+class A:
+   def __init__(self, x):
+       self.x = x
             
-            def __len__(self):
-                return self.x + 8
+   def __len__(self):
+       return self.x + 8
 
-            def raising(self):
-                1/0
+   def raising(self):
+       1/0
 
-            def method(self, x):
-                return x() + self.x
+   def method(self, x):
+       return x() + self.x
 
-        a = A(3)
-
-        def count():
-            x = 10
-            # naive counting :)
-            result = 1
-            for i in range(x):
-                result += 1
-            return result
-        '''))
+a = A(3)
+
+def count():
+    x = 10
+    # naive counting :)
+    result = 1
+    for i in range(x):
+        result += 1
+    return result
+'''
         return remote_side_code
-        """)
+        """ % str(py.path.local(__file__).dirpath().dirpath().dirpath().dirpath()))
 
     def test_remote_call(self):
         from distributed import socklayer
+        import sys
         from py.__.green.greenexecnet import PopenGateway
         gw = PopenGateway()
         rp = socklayer.spawn_remote_side(self.remote_side_code, gw)



More information about the Pypy-commit mailing list