[Zope-Checkins] CVS: Zope/lib/python/Zope/Startup/tests - test_schema.py:1.9

Chris McDonough chrism at zope.com
Sun Aug 17 18:08:11 EDT 2003


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

Modified Files:
	test_schema.py 
Log Message:
Import tempstorage from its new location instead of from TemporaryFolder.

Implement new "environment" section in config file which allows the
setting of environment variables within the configuration file.

Implement new "path" section in config file which allows insertions into
the Python module search path within the configuration file.

Fix bug where $INSTANCE/Products was not inserted into the products
path by default.

Note that most of these changes are for more comprehensive Windows service
support.  Windows can't run a batch file as a service, and sometimes it
is necessary to both munge the python module search path and environment
at startup time.  Instead of writing an executable application to do this,
we rely on the configuration machinery.




=== Zope/lib/python/Zope/Startup/tests/test_schema.py 1.8 => 1.9 ===
--- Zope/lib/python/Zope/Startup/tests/test_schema.py:1.8	Thu Jul 24 01:20:19 2003
+++ Zope/lib/python/Zope/Startup/tests/test_schema.py	Sun Aug 17 17:08:05 2003
@@ -54,7 +54,7 @@
             os.rmdir(TEMPPRODUCTS)
             os.rmdir(TEMPNAME)
         self.assertEqual(conf.instancehome, TEMPNAME)
-        return conf
+        return conf, handler
 
     def test_load_config_template(self):
         schema = self.schema
@@ -66,7 +66,7 @@
         self.load_config_text(text)
 
     def test_cgi_environment(self):
-        conf = self.load_config_text("""\
+        conf, handler = self.load_config_text("""\
             # instancehome is here since it's required
             instancehome <<INSTANCE_HOME>>
             <cgi-environment>
@@ -78,9 +78,32 @@
         items.sort()
         self.assertEqual(items, [("ANOTHER", "value2"), ("HEADER", "value")])
 
+    def test_environment(self):
+        conf, handler = self.load_config_text("""\
+            # instancehome is here since it's required
+            instancehome <<INSTANCE_HOME>>
+            <environment>
+              FEARFACTORY rocks
+              NSYNC doesnt
+            </environment>
+            """)
+        items = conf.environment.items()
+        items.sort()
+        self.assertEqual(items, [("FEARFACTORY", "rocks"), ("NSYNC","doesnt")])
+
+    def test_path(self):
+        conf, handler = self.load_config_text("""\
+            # instancehome is here since it's required
+            instancehome <<INSTANCE_HOME>>
+            path /foo/bar
+            path /baz/bee
+            """)
+        items = conf.path
+        self.assertEqual(items, ['/foo/bar', '/baz/bee'])
+
     def test_access_and_trace_logs(self):
         fn = tempfile.mktemp()
-        conf = self.load_config_text("""
+        conf, handler = self.load_config_text("""
             instancehome <<INSTANCE_HOME>>
             <logger access>
               <logfile>
@@ -95,14 +118,14 @@
 
     def test_dns_resolver(self):
         from ZServer.medusa import resolver
-        conf = self.load_config_text("""\
+        conf, handler = self.load_config_text("""\
             instancehome <<INSTANCE_HOME>>
             dns-server localhost
             """)
         self.assert_(isinstance(conf.dns_resolver, resolver.caching_resolver))
 
     def test_zodb_db(self):
-        conf = self.load_config_text("""\
+        conf, handler = self.load_config_text("""\
             instancehome <<INSTANCE_HOME>>
             <zodb_db main>
               <filestorage>




More information about the Zope-Checkins mailing list