[Zope-Checkins] CVS: Zope/lib/python/SearchIndex/tests - testSplitter.py:1.5 testUnKeywordIndex.py:1.8 testUnTextIndex.py:1.12 test_UnIndex.py:1.7 framework.py:NONE

Shane Hathaway shane@cvs.zope.org
Wed, 12 Jun 2002 16:39:50 -0400


Update of /cvs-repository/Zope/lib/python/SearchIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv5054/lib/python/SearchIndex/tests

Modified Files:
	testSplitter.py testUnKeywordIndex.py testUnTextIndex.py 
	test_UnIndex.py 
Removed Files:
	framework.py 
Log Message:
It's really not safe for unit test modules to change sys.path.  Doing
so makes the full suite brittle.  Cleaned out all the places where unit
tests change sys.path.  (Use the PYTHONPATH environment variable instead.)

Also brought SearchIndex tests up to date, which I didn't really need to do
since SearchIndex is deprecated, but I did it as part of figuring out the
failed Interface tests, so I might as well check in my work. ;-)  One of the
test modules in SearchIndex forgets to define a global named "Dummy",
actually, so all the tests were failing before this checkin anyway.


=== Zope/lib/python/SearchIndex/tests/testSplitter.py 1.4 => 1.5 ===
 # 
 ##############################################################################
-import os, sys
-execfile(os.path.join(sys.path[0], 'framework.py'))
+import unittest
 
 from SearchIndex.Splitter import Splitter
 
-class TestSplitter(unittest.TestCase):
+class Tests(unittest.TestCase):
    def testSplitNormalText(self):
        text = 'this is a long string of words'
        a = Splitter(text)
@@ -40,4 +39,10 @@
        r = map(None, a)
        assert r == ['without', 'you', 'nothing'], r
        
-framework()
+def test_suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(Tests),
+        ))
+
+if __name__=='__main__':
+    unittest.main(defaultTest='test_suite')


=== Zope/lib/python/SearchIndex/tests/testUnKeywordIndex.py 1.7 => 1.8 ===
 # 
 ##############################################################################
-import os, sys
-execfile(os.path.join(sys.path[0], 'framework.py'))
+import unittest
 
 import ZODB
 from SearchIndex.UnKeywordIndex import UnKeywordIndex
@@ -29,7 +28,7 @@
     
     __repr__ = __str__
 
-class TestCase( unittest.TestCase ):
+class Tests( unittest.TestCase ):
     """
         Test KeywordIndex objects.
     """
@@ -172,4 +171,10 @@
         assert len(result) == 1
         assert result[0] == 8
 
-framework()
+def test_suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(Tests),
+        ))
+
+if __name__=='__main__':
+    unittest.main(defaultTest='test_suite')


=== Zope/lib/python/SearchIndex/tests/testUnTextIndex.py 1.11 => 1.12 ===
 ##############################################################################
 
-import os, sys
-execfile(os.path.join(sys.path[0], 'framework.py'))
+import unittest
 
 from Testing.ZODButil import makeDB, cleanDB
 
@@ -205,4 +204,10 @@
        self.globTest({'text':'((?ount* or get) and not wait) '
                       '"been *ert*"'}, [0, 1, 5, 6])
        
-framework()
+def test_suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(Tests),
+        ))
+
+if __name__=='__main__':
+    unittest.main(defaultTest='test_suite')


=== Zope/lib/python/SearchIndex/tests/test_UnIndex.py 1.6 => 1.7 ===
 ##############################################################################
 
-import os, sys
-execfile(os.path.join(sys.path[0], 'framework.py'))
+import unittest
 
 import ZODB
 from SearchIndex.UnIndex import UnIndex
@@ -30,7 +29,7 @@
     
     __repr__ = __str__
 
-class TestCase( unittest.TestCase ):
+class Tests( unittest.TestCase ):
     """
         Test FieldIndex objects.
     """
@@ -171,4 +170,10 @@
         assert r==expect, r 
             
         
-framework()
+def test_suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(Tests),
+        ))
+
+if __name__=='__main__':
+    unittest.main(defaultTest='test_suite')

=== Removed File Zope/lib/python/SearchIndex/tests/framework.py ===