[z3-checkins] r5223 - z3/Five/trunk/tests

faassen at codespeak.net faassen at codespeak.net
Tue Jun 22 10:48:08 MEST 2004


Author: faassen
Date: Tue Jun 22 10:48:07 2004
New Revision: 5223

Added:
   z3/Five/trunk/tests/zopeconf.py
Modified:
   z3/Five/trunk/tests/framework.py
   z3/Five/trunk/tests/test_five.py
   z3/Five/trunk/tests/test_security.py
Log:
Clean up test system somewhat, moving duplicated zopeconf finding crud into
its own module which gets triggered from framework.py.


Modified: z3/Five/trunk/tests/framework.py
==============================================================================
--- z3/Five/trunk/tests/framework.py	(original)
+++ z3/Five/trunk/tests/framework.py	Tue Jun 22 10:48:07 2004
@@ -99,6 +99,9 @@
         print 'Unable to locate %s.' % ztc_common
         sys.exit(1)
 
+    # run configuration
+    import zopeconf; zopeconf.process()
+    
 # Debug
 #
 print 'SOFTWARE_HOME: %s' % os.environ.get('SOFTWARE_HOME', 'Not set')

Modified: z3/Five/trunk/tests/test_five.py
==============================================================================
--- z3/Five/trunk/tests/test_five.py	(original)
+++ z3/Five/trunk/tests/test_five.py	Tue Jun 22 10:48:07 2004
@@ -1,23 +1,8 @@
 import os, sys
-from os import curdir
-from os.path import join, abspath, dirname, split
-
-try:
-    __file__
-except NameError:
-    # Test was called directly, so no __file__ global exists.
-    _prefix = abspath(curdir)
-else:
-    # Test was called by another test.
-    _prefix = abspath(dirname(__file__))
 
 if __name__ == '__main__':
     execfile(os.path.join(sys.path[0], 'framework.py'))
 
-# XXX hack but no other way to initialize options apparently
-from Zope.Startup.run import configure
-configure(join(_prefix, '..', '..', '..', 'etc', 'zope.conf'))
-
 import unittest
 from Testing import ZopeTestCase
 

Modified: z3/Five/trunk/tests/test_security.py
==============================================================================
--- z3/Five/trunk/tests/test_security.py	(original)
+++ z3/Five/trunk/tests/test_security.py	Tue Jun 22 10:48:07 2004
@@ -1,23 +1,8 @@
 import os, sys
-from os import curdir
-from os.path import join, abspath, dirname, split
-
-try:
-    __file__
-except NameError:
-    # Test was called directly, so no __file__ global exists.
-    _prefix = abspath(curdir)
-else:
-    # Test was called by another test.
-    _prefix = abspath(dirname(__file__))
 
 if __name__ == '__main__':
     execfile(os.path.join(sys.path[0], 'framework.py'))
 
-# XXX hack but no other way to initialize options apparently
-from Zope.Startup.run import configure
-configure(join(_prefix, '..', '..', '..', 'etc', 'zope.conf'))
-
 import unittest
 from Testing import ZopeTestCase
 

Added: z3/Five/trunk/tests/zopeconf.py
==============================================================================
--- (empty file)
+++ z3/Five/trunk/tests/zopeconf.py	Tue Jun 22 10:48:07 2004
@@ -0,0 +1,19 @@
+from os import curdir
+from os.path import join, abspath, dirname, split
+
+def process():
+    """Read in zope.conf configuration file.
+
+    This is a hack but there doesn't seem to be a better way.
+    """
+    try:
+        __file__
+    except NameError:
+        # Test was called directly, so no __file__ global exists.
+        _prefix = abspath(curdir)
+    else:
+        # Test was called by another test.
+        _prefix = abspath(dirname(__file__))
+
+    from Zope.Startup.run import configure
+    configure(join(_prefix, '..', '..', '..', 'etc', 'zope.conf'))


More information about the z3-checkins mailing list