[Zope-Checkins] CVS: Zope/lib/python/Zope/Startup/tests - testStarter.py:1.1.2.9

Chris McDonough chrism at zopemafia.com
Sun Dec 21 19:24:26 EST 2003


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

Modified Files:
      Tag: Zope-2_7-branch
	testStarter.py 
Log Message:
Created 'configure' API function. The 'configure' API function accepts a config
file path and does for scripts what "start_zope" does for interactive startup.

Use the configure function from within zopectl, replacing some gnarly exec'd code.


=== Zope/lib/python/Zope/Startup/tests/testStarter.py 1.1.2.8 => 1.1.2.9 ===
--- Zope/lib/python/Zope/Startup/tests/testStarter.py:1.1.2.8	Thu Dec 18 15:34:10 2003
+++ Zope/lib/python/Zope/Startup/tests/testStarter.py	Sun Dec 21 19:24:25 2003
@@ -22,7 +22,7 @@
 import Zope.Startup
 from Zope.Startup import ZopeStarter
 
-from App.config import getConfiguration
+from App.config import getConfiguration, setConfiguration
 import logging
 
 TEMPNAME = tempfile.mktemp()
@@ -336,6 +336,32 @@
         finally:
             starter.unlinkPidFile()
             self.failIf(os.path.exists(name))
+
+    def testZopeRunConfigure(self):
+        old_config = getConfiguration()
+        try:
+            os.mkdir(TEMPNAME)
+            os.mkdir(TEMPPRODUCTS)
+        except OSError, why:
+            if why == 17:
+                # already exists
+                pass
+        try:
+            fname = os.path.join(TEMPNAME, 'zope.conf')
+            from Zope import configure
+            f = open(fname, 'w')
+            f.write('instancehome %s\nzserver-threads 100\n' % TEMPNAME)
+            f.flush()
+            f.close()
+            configure(fname)
+            new_config = getConfiguration()
+            self.failUnlessEqual(new_config.zserver_threads, 100)
+        finally:
+            try:
+                os.unlink(fname)
+            except:
+                pass
+            setConfiguration(old_config)
 
 def test_suite():
     return unittest.makeSuite(ZopeStarterTestCase)




More information about the Zope-Checkins mailing list