[Zope-Checkins] CVS: Zope/lib/python/Products/PythonScripts/tests - __init__.py:1.1.2.1 testPythonScript.py:1.6.20.1 framework.py:NONE

Tres Seaver tseaver@zope.com
Mon, 15 Oct 2001 15:43:06 -0400


Update of /cvs-repository/Zope/lib/python/Products/PythonScripts/tests
In directory cvs.zope.org:/tmp/cvs-serv2080

Modified Files:
      Tag: tseaver-utxfixup-branch
	testPythonScript.py 
Added Files:
      Tag: tseaver-utxfixup-branch
	__init__.py 
Removed Files:
      Tag: tseaver-utxfixup-branch
	framework.py 
Log Message:


 - Remove dependency on 'execfile( "framework.py" )'.


=== Added File Zope/lib/python/Products/PythonScripts/tests/__init__.py ===
# Placeholder, making tests into a Python package.


=== Zope/lib/python/Products/PythonScripts/tests/testPythonScript.py 1.6 => 1.6.20.1 ===
 # 
 ##############################################################################
-import os, sys
-execfile(os.path.join(sys.path[0], 'framework.py'))
+import os, sys, unittest
 
 import ZODB
 from Products.PythonScripts.PythonScript import PythonScript
@@ -91,10 +90,21 @@
 
 newSecurityManager(None, None)
 
+if __name__=='__main__':
+    sys.path.append(os.path.join(os.pardir, os.pardir, os.pardir))
+    here = os.curdir
+else:
+    from Products.PythonScripts import tests
+    from App.Common import package_home
+    here = package_home(tests.__dict__)
+
 # Test Classes
 
 def readf(name):
-    return open('tscripts/%s%s' % (name, '.ps'), 'r').read()
+    return open( os.path.join( here
+                             , 'tscripts'
+                             , '%s.ps' % name
+                             ), 'r').read()
 
 class TestPythonScriptNoAq(unittest.TestCase):
     def _newPS(self, txt, bind=None):
@@ -208,5 +218,14 @@
         true = self._newPS(readf('boolean_map'))()
         assert true
 
-framework()
+def test_suite():
+    suite = unittest.TestSuite()
+    suite.addTest( unittest.makeSuite( TestPythonScriptNoAq ) )
+    return suite
+
+def main():
+    unittest.TextTestRunner().run(test_suite())
+
+if __name__ == '__main__':
+    main()
 

=== Removed File Zope/lib/python/Products/PythonScripts/tests/framework.py ===