[py-svn] r45295 - in py/trunk/py/test/rsession: . testing webdata

fijal at codespeak.net fijal at codespeak.net
Tue Jul 24 11:32:44 CEST 2007


Author: fijal
Date: Tue Jul 24 11:32:44 2007
New Revision: 45295

Modified:
   py/trunk/py/test/rsession/testing/test_web.py
   py/trunk/py/test/rsession/web.py
   py/trunk/py/test/rsession/webdata/source.js
Log:
Fix rsession tests


Modified: py/trunk/py/test/rsession/testing/test_web.py
==============================================================================
--- py/trunk/py/test/rsession/testing/test_web.py	(original)
+++ py/trunk/py/test/rsession/testing/test_web.py	Tue Jul 24 11:32:44 2007
@@ -24,7 +24,7 @@
     from py.__.test.rsession import webjs
     from py.__.test.rsession.web import FUNCTION_LIST, IMPORTED_PYPY
     
-    source = rpython2javascript(webjs, FUNCTION_LIST)
+    source = rpython2javascript(webjs, FUNCTION_LIST, use_pdb=False)
     assert source
 
 def test_parse_args():

Modified: py/trunk/py/test/rsession/web.py
==============================================================================
--- py/trunk/py/test/rsession/web.py	(original)
+++ py/trunk/py/test/rsession/web.py	Tue Jul 24 11:32:44 2007
@@ -24,11 +24,10 @@
     "show_host", "hide_host", "hide_messagebox", "opt_scroll"]
 
 try:
-    from pypy.rpython.ootypesystem.bltregistry import MethodDesc, BasicExternal,\
-                                                      described
+    from pypy.rpython.ootypesystem.bltregistry import MethodDesc, BasicExternal
     from pypy.translator.js.main import rpython2javascript
     from pypy.translator.js import commproxy
-    from pypy.rpython.extfunc import _callable
+    from pypy.translator.js.lib.support import callback
 
     commproxy.USE_MOCHIKIT = False
     IMPORTED_PYPY = True
@@ -36,14 +35,11 @@
     class BasicExternal(object):
         pass
 
-    def described(*args, **kwargs):
+    def callback(*args, **kwargs):
         def decorator(func):
             return func
         return decorator
 
-    def _callable(*args, **kwargs):
-        pass
-
     IMPORTED_PYPY = False
 
 def add_item(event):
@@ -153,22 +149,19 @@
         for host in self.hosts:
             to_send[host.hostid] = host.hostname
         return to_send
-    show_hosts = described(retval={str:str}, args=[('callback',
-            _callable([{str:str}]))])(show_hosts)
+    show_hosts = callback(retval={str:str})(show_hosts)
     
     def show_skip(self, item_name="aa"):
         return {'item_name': item_name,
                            'reason': self.skip_reasons[item_name]}
-    show_skip = described(retval={str:str}, args=[('item_name',str),('callback',
-            _callable([{str:str}]))])(show_skip)
+    show_skip = callback(retval={str:str})(show_skip)
     
     def show_fail(self, item_name="aa"):
         return {'item_name':item_name,
                            'traceback':str(self.fail_reasons[item_name]),
                            'stdout':self.stdout[item_name],
                            'stderr':self.stderr[item_name]}
-    show_fail = described(retval={str:str}, args=[('item_name',str),('callback',
-            _callable([{str:str}]))])(show_fail)
+    show_fail = callback(retval={str:str})(show_fail)
     
     _sessids = None
     _sesslock = py.std.thread.allocate_lock()
@@ -186,8 +179,7 @@
         finally:
             self._sesslock.release()
         return sessid
-    show_sessid = described(retval=str, args=[('callback',
-            _callable([str]))])(show_sessid)
+    show_sessid = callback(retval=str)(show_sessid)
     
     def failed(self, **kwargs):
         if not 'sessid' in kwargs:
@@ -201,14 +193,13 @@
             del self._sessids[to_del]
         self.pending_events._del(kwargs['sessid'])
     
-    def show_all_statuses(self, sessid=-1):
+    def show_all_statuses(self, sessid='xx'):
         retlist = [self.show_status_change(sessid)]
         while not self.pending_events.empty_queue(sessid):
             retlist.append(self.show_status_change(sessid))
         retval = retlist
         return retval
-    show_all_statuses = described(retval=[{str:str}],args=
-         [('sessid',str), ('callback',_callable([[{str:str}]]))])(show_all_statuses)
+    show_all_statuses = callback(retval=[{str:str}])(show_all_statuses)
         
     def show_status_change(self, sessid):
         event = self.pending_events.get(sessid)
@@ -408,7 +399,8 @@
     def run_jssource(self):
         js_name = py.path.local(__file__).dirpath("webdata").join("source.js")
         web_name = py.path.local(__file__).dirpath().join("webjs.py")
-        if IMPORTED_PYPY and web_name.mtime() > js_name.mtime():
+        if IMPORTED_PYPY and web_name.mtime() > js_name.mtime() or \
+            (not js_name.check()) or 1:
             from py.__.test.rsession import webjs
 
             javascript_source = rpython2javascript(webjs,

Modified: py/trunk/py/test/rsession/webdata/source.js
==============================================================================
Binary files. No diff available.



More information about the pytest-commit mailing list