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

Tim Peters cvs-admin at zope.org
Mon Nov 3 11:43:27 EST 2003


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

Modified Files:
      Tag: Zope-2_7-branch
	testStarter.py 
Log Message:
Zope collector #1104:  testSetupServers fails on Windows

testSetupServers():  The second half of this test tries creating an HTTP
server and an FTP server both using the same port.  It hopes to get a
ConfigurationError, relying on socket.bind() complaining about the double-
bind.  However, because SO_REUSEADDR has been specified for the sockets,
Linux may be the only OS under which socket.bind() actually complains.
It doesn't complain on Windows.  See the collector comments for evidence
that it won't complain under most other Unixish OSes either.

Simply commented out that half of the test, since it can't be expected to
pass.  Fred said Jim said it's OK that we don't try to catch the port
reuse by magic.


=== Zope/lib/python/Zope/Startup/tests/testStarter.py 1.1.2.6 => 1.1.2.7 ===
--- Zope/lib/python/Zope/Startup/tests/testStarter.py:1.1.2.6	Fri Oct 31 11:47:32 2003
+++ Zope/lib/python/Zope/Startup/tests/testStarter.py	Mon Nov  3 11:43:27 2003
@@ -178,23 +178,30 @@
         finally:
             del conf.servers # should release servers
             pass
-        conf = self.load_config_text("""
-            instancehome <<INSTANCE_HOME>>
-            <http-server>
-                address 18092
-            </http-server>
-            <ftp-server>
-               # conflict
-               address 18092
-            </ftp-server>""")
-        starter = ZopeStarter(conf)
-        # do the job the 'handler' would have done (call prepare)
-        for server in conf.servers:
-            server.prepare('', None, 'Zope', {}, None)
-        try:
-            self.assertRaises(ZConfig.ConfigurationError, starter.setupServers)
-        finally:
-            del conf.servers
+
+        # The rest sets up a conflict by using the same port for the HTTP
+        # and FTP servers, relying on socket.bind() to raise an "address
+        # already in use" exception.  However, because the sockets specify
+        # SO_REUSEADDR, socket.bind() may not raise that exception.
+        # See <http://zope.org/Collectors/Zope/1104> for gory details.
+
+        ## conf = self.load_config_text("""
+        ##     instancehome <<INSTANCE_HOME>>
+        ##     <http-server>
+        ##         address 18092
+        ##     </http-server>
+        ##     <ftp-server>
+        ##        # conflict
+        ##        address 18092
+        ##     </ftp-server>""")
+        ## starter = ZopeStarter(conf)
+        ## # do the job the 'handler' would have done (call prepare)
+        ## for server in conf.servers:
+        ##     server.prepare('', None, 'Zope', {}, None)
+        ## try:
+        ##     self.assertRaises(ZConfig.ConfigurationError, starter.setupServers)
+        ## finally:
+        ##     del conf.servers
 
     def testDropPrivileges(self):
         # somewhat incomplete because we we're never running as root




More information about the Zope-Checkins mailing list