You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-commits@lucene.apache.org by va...@apache.org on 2010/05/18 20:11:50 UTC

svn commit: r945800 - in /lucene/pylucene/branches/branch_3x/samples/LuceneInAction/lia/indexing: BaseIndexingTestCase.py FSversusRAMDirectoryTest.py LockTest.py

Author: vajda
Date: Tue May 18 18:11:50 2010
New Revision: 945800

URL: http://svn.apache.org/viewvc?rev=945800&view=rev
Log:
added some rmdir's to cleanup tmp index dirs

Modified:
    lucene/pylucene/branches/branch_3x/samples/LuceneInAction/lia/indexing/BaseIndexingTestCase.py
    lucene/pylucene/branches/branch_3x/samples/LuceneInAction/lia/indexing/FSversusRAMDirectoryTest.py
    lucene/pylucene/branches/branch_3x/samples/LuceneInAction/lia/indexing/LockTest.py

Modified: lucene/pylucene/branches/branch_3x/samples/LuceneInAction/lia/indexing/BaseIndexingTestCase.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/branches/branch_3x/samples/LuceneInAction/lia/indexing/BaseIndexingTestCase.py?rev=945800&r1=945799&r2=945800&view=diff
==============================================================================
--- lucene/pylucene/branches/branch_3x/samples/LuceneInAction/lia/indexing/BaseIndexingTestCase.py (original)
+++ lucene/pylucene/branches/branch_3x/samples/LuceneInAction/lia/indexing/BaseIndexingTestCase.py Tue May 18 18:11:50 2010
@@ -33,9 +33,18 @@ class BaseIndexingTestCase(TestCase):
 
         indexDir = os.path.join(System.getProperty('java.io.tmpdir', 'tmp'),
                                 'index-dir')
+        self.rmdir(indexDir)
         self.dir = SimpleFSDirectory(File(indexDir))
         self.addDocuments(self.dir)
 
+    def rmdir(self, dir):
+
+        for dir, dirnames, filenames in os.walk(dir):
+            for filename in filenames:
+                os.remove(os.path.join(dir, filename))
+            for dirname in dirnames:
+                os.rmdir(os.path.join(dir, dirname))
+
     def addDocuments(self, dir):
 
         writer = IndexWriter(dir, self.getAnalyzer(), True,

Modified: lucene/pylucene/branches/branch_3x/samples/LuceneInAction/lia/indexing/FSversusRAMDirectoryTest.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/branches/branch_3x/samples/LuceneInAction/lia/indexing/FSversusRAMDirectoryTest.py?rev=945800&r1=945799&r2=945800&view=diff
==============================================================================
--- lucene/pylucene/branches/branch_3x/samples/LuceneInAction/lia/indexing/FSversusRAMDirectoryTest.py (original)
+++ lucene/pylucene/branches/branch_3x/samples/LuceneInAction/lia/indexing/FSversusRAMDirectoryTest.py Tue May 18 18:11:50 2010
@@ -34,9 +34,18 @@ class FSversusRAMDirectoryTest(TestCase)
 
         fsIndexDir = os.path.join(System.getProperty("java.io.tmpdir", "tmp"),
                                   "fs-index")
+        self.rmdir(fsIndexDir)
         self.ramDir = RAMDirectory()
         self.fsDir = SimpleFSDirectory(File(fsIndexDir))
 
+    def rmdir(self, dir):
+
+        for dir, dirnames, filenames in os.walk(dir):
+            for filename in filenames:
+                os.remove(os.path.join(dir, filename))
+            for dirname in dirnames:
+                os.rmdir(os.path.join(dir, dirname))
+
     def testTiming(self):
 
         ramTiming = self.timeIndexWriter(self.ramDir)

Modified: lucene/pylucene/branches/branch_3x/samples/LuceneInAction/lia/indexing/LockTest.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/branches/branch_3x/samples/LuceneInAction/lia/indexing/LockTest.py?rev=945800&r1=945799&r2=945800&view=diff
==============================================================================
--- lucene/pylucene/branches/branch_3x/samples/LuceneInAction/lia/indexing/LockTest.py (original)
+++ lucene/pylucene/branches/branch_3x/samples/LuceneInAction/lia/indexing/LockTest.py Tue May 18 18:11:50 2010
@@ -26,8 +26,17 @@ class LockTest(TestCase):
 
         indexDir = os.path.join(System.getProperty("java.io.tmpdir", "tmp"),
                                 "index")
+        self.rmdir(indexDir)
         self.dir = SimpleFSDirectory(File(indexDir))
 
+    def rmdir(self, dir):
+
+        for dir, dirnames, filenames in os.walk(dir):
+            for filename in filenames:
+                os.remove(os.path.join(dir, filename))
+            for dirname in dirnames:
+                os.rmdir(os.path.join(dir, dirname))
+
     def testWriteLock(self):
 
         writer1 = IndexWriter(self.dir, SimpleAnalyzer(),