changeset 4762:08dfaece84ad

test_search: calls now nuke_xapian_index for deleting everything in xapian index dir
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Mon, 20 Jul 2009 12:47:36 +0200
parents 83390406fc5c
children ab696b0a23f2
files MoinMoin/_tests/__init__.py MoinMoin/search/_tests/test_search.py
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/__init__.py	Mon Jul 20 01:19:31 2009 +0200
+++ b/MoinMoin/_tests/__init__.py	Mon Jul 20 12:47:36 2009 +0200
@@ -115,3 +115,9 @@
     p.form = request.form
     m = macro.Macro(p)
     return m
+
+def nuke_xapian_index(request):
+    """ completely delete everything in xapian index dir """
+    fpath = os.path.join(request.cfg.cache_dir, 'xapian')
+    if os.path.exists(fpath):
+        shutil.rmtree(fpath, True)
--- a/MoinMoin/search/_tests/test_search.py	Mon Jul 20 01:19:31 2009 +0200
+++ b/MoinMoin/search/_tests/test_search.py	Mon Jul 20 12:47:36 2009 +0200
@@ -13,7 +13,7 @@
 from MoinMoin.search.queryparser import QueryParser
 from MoinMoin.search import Xapian
 from MoinMoin import search
-
+from MoinMoin._tests import nuke_xapian_index
 
 class TestQueryParsing:
     """ search: query parser tests """
@@ -119,6 +119,7 @@
 
         idx = Xapian.Index(self.request)
         idx.indexPages(['HomePageWiki'], mode='add')
+        nuke_xapian_index(self.request)
 
     def testIndexInNewThread(self):
         """ search: kicks off indexing for a page in a new thread in Xapian"""
@@ -127,6 +128,7 @@
 
         idx = Xapian.Index(self.request)
         idx.indexPagesInNewThread(['HomePageWiki'], mode='add')
+        nuke_xapian_index(self.request)
 
 coverage_modules = ['MoinMoin.search']