[py-svn] r35347 - in py/dist/py/test/rsession: . testing

fijal at codespeak.net fijal at codespeak.net
Tue Dec 5 23:06:19 CET 2006


Author: fijal
Date: Tue Dec  5 23:06:12 2006
New Revision: 35347

Modified:
   py/dist/py/test/rsession/testing/test_webjs.py
   py/dist/py/test/rsession/web.py
Log:
Fix tests, add new and increase testability a bit.


Modified: py/dist/py/test/rsession/testing/test_webjs.py
==============================================================================
--- py/dist/py/test/rsession/testing/test_webjs.py	(original)
+++ py/dist/py/test/rsession/testing/test_webjs.py	Tue Dec  5 23:06:12 2006
@@ -115,8 +115,12 @@
            'signal': '10',
            'skipped': 'False',
            }
+    exported_methods.fail_reasons['modules/foo.py/test_item'] = 'Received signal 10'
+    exported_methods.stdout['modules/foo.py/test_item'] = ''
+    exported_methods.stderr['modules/foo.py/test_item'] = ''
     webjs.process(msg)
     print '<html>%s</html>' % (dom.get_document().documentElement.innerHTML,)
     schedule_callbacks(exported_methods)
-    import pdb;pdb.set_trace()
-    assert main_t.getElementById('modules/foo.py')
+    # ouch
+    assert dom.get_document().getElementById('modules/foo.py').childNodes[1].\
+        childNodes[0].childNodes[0].childNodes[0].nodeValue == 'F'

Modified: py/dist/py/test/rsession/web.py
==============================================================================
--- py/dist/py/test/rsession/web.py	(original)
+++ py/dist/py/test/rsession/web.py	Tue Dec  5 23:06:12 2006
@@ -152,19 +152,19 @@
     
     def show_hosts(self):
         self.start_event.wait()
-        return json.write(self.hosts)
+        return self.hosts
     show_hosts = described(retval={"aa": "aa"})(show_hosts)
     
     def show_skip(self, item_name="aa"):
-        return json.write({'item_name': item_name,
-                           'reason': escape(self.skip_reasons[item_name])})
+        return {'item_name': item_name,
+                           'reason': escape(self.skip_reasons[item_name])}
     show_skip = described(retval={"aa": "aa"})(show_skip)
     
     def show_fail(self, item_name="aa"):
-        return json.write({'item_name':item_name,
+        return {'item_name':item_name,
                            'traceback':escape(str(self.fail_reasons[item_name])),
                            'stdout':self.stdout[item_name],
-                           'stderr':self.stderr[item_name]})
+                           'stderr':self.stderr[item_name]}
     show_fail = described(retval={"aa": "aa"})(show_fail)
     
     _sessids = None
@@ -183,7 +183,7 @@
                     break
         finally:
             self._sesslock.release()
-        return json.write(sessid)
+        return sessid
     show_sessid = described(retval="aa")(show_sessid)
     
     def failed(self, **kwargs):
@@ -202,7 +202,7 @@
         retlist = [self.show_status_change(sessid)]
         while not self.pending_events.empty_queue(sessid):
             retlist.append(self.show_status_change(sessid))
-        retval = json.write(retlist)
+        retval = retlist
         return retval
     show_all_statuses = described(retval=[{"aa": "aa"}])(show_all_statuses)
         
@@ -347,7 +347,7 @@
             else:
                 try:
                     self.serve_data('text/json',
-                                exec_meth(**self.parse_args(getargs)))
+                                json.write(exec_meth(**self.parse_args(getargs))))
                 except socket.error:
                     # client happily disconnected
                     exported_methods.failed(**self.parse_args(getargs))



More information about the pytest-commit mailing list