[Zope-Checkins] CVS: Products/PythonScripts/tests - framework.py:1.1.2.1 testPythonScript.py:1.4.16.2

Evan Simpson evan@cvs.zope.org
Mon, 6 Aug 2001 13:16:42 -0400


Update of /cvs-repository/Products/PythonScripts/tests
In directory cvs.zope.org:/tmp/cvs-serv1419/Products/PythonScripts/tests

Modified Files:
      Tag: Zope-2_4-branch
	testPythonScript.py 
Added Files:
      Tag: Zope-2_4-branch
	framework.py 
Log Message:
Added new unit test framework, changed several test suites to use it.


=== Added File Products/PythonScripts/tests/framework.py ===


=== Products/PythonScripts/tests/testPythonScript.py 1.4.16.1 => 1.4.16.2 ===
 # 
 ##############################################################################
-import sys
-
-try:
-    sys.path.insert(0, '.')
-    import ZODB
-except:
-    sys.path.insert(0, '../../..')
-    import ZODB
+import os, sys
+execfile(os.path.join(sys.path[0], 'framework.py'))
 
+import ZODB
 from Products.PythonScripts.PythonScript import PythonScript
 from AccessControl.SecurityManagement import newSecurityManager
 
 newSecurityManager(None, None)
 
-from unittest import TestCase, TestSuite, VerboseTextTestRunner, makeSuite
-
-TextTestRunner = VerboseTextTestRunner
-
 # Test Classes
 
 def readf(name):
     return open('tscripts/%s%s' % (name, '.ps'), 'r').read()
 
-class TestPythonScriptNoAq(TestCase):
+class TestPythonScriptNoAq(unittest.TestCase):
     def _newPS(self, txt, bind=None):
         ps = PythonScript('ps')
         ps.ZBindings_edit(bind or {})
@@ -217,29 +208,5 @@
         true = self._newPS(readf('boolean_map'))()
         assert true
 
-
-test_classes = (TestPythonScriptNoAq,)
-
-# unit test machinery
-
-def test_suite():
-    ts = []
-    for tclass in test_classes:
-        ts.append(makeSuite(tclass, 'test'))
-    
-    return TestSuite(tuple(ts))
-
-def main():
-    alltests=test_suite()
-    runner = TextTestRunner()
-    runner.run(alltests)
-
-def debug():
-   test_suite().debug()
-    
-if __name__=='__main__':
-   if len(sys.argv) > 1:
-      globals()[sys.argv[1]]()
-   else:
-      main()
+framework()