[pypy-svn] pypy default: Fix thread tests.

alex_gaynor commits-noreply at bitbucket.org
Wed Jan 19 17:26:49 CET 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r40939:e123d4efa50a
Date: 2011-01-19 10:15 -0600
http://bitbucket.org/pypy/pypy/changeset/e123d4efa50a/

Log:	Fix thread tests.

diff --git a/pypy/module/thread/test/support.py b/pypy/module/thread/test/support.py
--- a/pypy/module/thread/test/support.py
+++ b/pypy/module/thread/test/support.py
@@ -7,7 +7,7 @@
 
 NORMAL_TIMEOUT = 300.0   # 5 minutes
 
-def waitfor(space, w_condition, delay=1):
+def waitfor(w_self, space, w_condition, delay=1):
     adaptivedelay = 0.04
     limit = time.time() + delay * NORMAL_TIMEOUT
     while time.time() <= limit:
@@ -19,15 +19,15 @@
             return
         adaptivedelay *= 1.05
     print '*** timed out ***'
-waitfor.unwrap_spec = [ObjSpace, W_Root, float]
+waitfor.unwrap_spec = [W_Root, ObjSpace, W_Root, float]
 
-def timeout_killer(pid, delay):
+def timeout_killer(w_self, pid, delay):
     def kill():
         time.sleep(delay)
         os.kill(pid, 9)
         print "process %s killed!" % (pid,)
     thread.start_new_thread(kill, ())
-timeout_killer.unwrap_spec = [int, float]
+timeout_killer.unwrap_spec = [W_Root, int, float]
 
 class GenericTestThread:
 
@@ -36,7 +36,7 @@
         cls.space = space
 
         if option.runappdirect:
-            def plain_waitfor(condition, delay=1):
+            def plain_waitfor(self, condition, delay=1):
                 adaptivedelay = 0.04
                 limit = time.time() + NORMAL_TIMEOUT * delay
                 while time.time() <= limit:
@@ -54,4 +54,8 @@
             import time
             return time.sleep
         """)
-        cls.w_timeout_killer = space.wrap(interp2app_temp(timeout_killer))
+        
+        if option.runappdirect:
+            cls.w_timeout_killer = timeout_killer
+        else:
+            cls.w_timeout_killer = space.wrap(interp2app_temp(timeout_killer))


More information about the Pypy-commit mailing list