comparison test/test_indexer.py @ 3297:8f7dc283bfa5

some more Xapian stuff (doc, test fixes)
author Richard Jones <richard@users.sourceforge.net>
date Thu, 28 Apr 2005 09:06:09 +0000
parents a615cc230160
children a4edd24c32be
comparison
equal deleted inserted replaced
3296:d5fa5a0b5216 3297:8f7dc283bfa5
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 # SOFTWARE. 19 # SOFTWARE.
20 20
21 # $Id: test_indexer.py,v 1.7 2005-04-28 00:21:42 richard Exp $ 21 # $Id: test_indexer.py,v 1.8 2005-04-28 09:06:09 richard Exp $
22 22
23 import os, unittest, shutil 23 import os, unittest, shutil
24
25 class db:
26 class config:
27 DATABASE = 'test-index'
24 28
25 class IndexerTest(unittest.TestCase): 29 class IndexerTest(unittest.TestCase):
26 def setUp(self): 30 def setUp(self):
27 if os.path.exists('test-index'): 31 if os.path.exists('test-index'):
28 shutil.rmtree('test-index') 32 shutil.rmtree('test-index')
29 os.mkdir('test-index') 33 os.mkdir('test-index')
30 os.mkdir('test-index/files') 34 os.mkdir('test-index/files')
31 from roundup.backends.indexer_dbm import Indexer 35 from roundup.backends.indexer_dbm import Indexer
32 self.dex = Indexer('test-index') 36 self.dex = Indexer(db)
33 self.dex.load_index() 37 self.dex.load_index()
34 38
35 def test_basics(self): 39 def test_basics(self):
36 self.dex.add_text(('test', '1', 'foo'), 'a the hello world') 40 self.dex.add_text(('test', '1', 'foo'), 'a the hello world')
37 self.dex.add_text(('test', '2', 'foo'), 'blah blah the world') 41 self.dex.add_text(('test', '2', 'foo'), 'blah blah the world')
43 def tearDown(self): 47 def tearDown(self):
44 shutil.rmtree('test-index') 48 shutil.rmtree('test-index')
45 49
46 class XapianIndexerTest(IndexerTest): 50 class XapianIndexerTest(IndexerTest):
47 def setUp(self): 51 def setUp(self):
48 if os.path.exists('text-index'): 52 if os.path.exists('test-index'):
49 shutil.rmtree('text-index') 53 shutil.rmtree('test-index')
54 os.mkdir('test-index')
50 from roundup.backends.indexer_xapian import Indexer 55 from roundup.backends.indexer_xapian import Indexer
51 self.dex = Indexer('.') 56 self.dex = Indexer(db)
52 def tearDown(self): 57 def tearDown(self):
53 shutil.rmtree('text-index') 58 shutil.rmtree('test-index')
54 59
55 def test_suite(): 60 def test_suite():
56 suite = unittest.TestSuite() 61 suite = unittest.TestSuite()
57 suite.addTest(unittest.makeSuite(IndexerTest)) 62 suite.addTest(unittest.makeSuite(IndexerTest))
58 try: 63 try:

Roundup Issue Tracker: http://roundup-tracker.org/