changeset 4751:09c345615cd8

Put the finish method back on the context object so we can delay process such as thread joined until the end
author Andy Dawkins <andydawkins@gmail.com>
date Fri, 03 Jul 2009 15:17:23 +0100
parents 617c9c236bf0
children e6190a499a7e
files MoinMoin/search/_tests/test_search.py MoinMoin/wsgiapp.py
diffstat 2 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search/_tests/test_search.py	Fri Jul 03 13:31:25 2009 +0100
+++ b/MoinMoin/search/_tests/test_search.py	Fri Jul 03 15:17:23 2009 +0100
@@ -11,6 +11,7 @@
 
 from MoinMoin.search import QueryError
 from MoinMoin.search.queryparser import QueryParser
+from MoinMoin.search import Xapian
 from MoinMoin import search
 
 
@@ -108,5 +109,26 @@
         assert 0 < len(result.hits) < helpon_count
 
 
+class TestXapianIndex:
+    """ search: test Xapian indexing """
+
+    def testIndex(self):
+        """ search: kicks off indexing for a single pages in Xapian """
+        
+        # AD - This only tests the the call to indexing doesn't raise.
+        
+        idx = Xapian.Index( self.request )
+        idx.indexPages( ['HomePageWiki'], mode='add' )
+        
+    def testIndexInNewThread(self):
+        """ search: kicks off indexing for a page in a new thread in Xapian"""
+
+        # AD - This only tests the the call to indexing doesn't raise.
+
+        idx = Xapian.Index( self.request )
+        idx.indexPagesInNewThread( ['HomePageWiki'], mode='add' )
+
+        
+        
 coverage_modules = ['MoinMoin.search']
 
--- a/MoinMoin/wsgiapp.py	Fri Jul 03 13:31:25 2009 +0100
+++ b/MoinMoin/wsgiapp.py	Fri Jul 03 15:17:23 2009 +0100
@@ -38,6 +38,11 @@
 
     context.lang = setup_i18n_postauth(context)
 
+    def finish():
+        pass
+    
+    context.finish = finish
+    
     context.reset()
 
     context.clock.stop('init')
@@ -68,6 +73,7 @@
         except MoinMoinFinish:
             return request
     finally:
+        context.finish()
         context.clock.stop('run')
 
 def remove_prefix(path, prefix=None):