[Zope-Checkins] CVS: ZODB/src/ZEO/tests - testZEOOptions.py:1.2

Tim Peters tim.one at comcast.net
Fri Feb 20 12:56:09 EST 2004


Update of /cvs-repository/ZODB/src/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv1077/src/ZEO/tests

Modified Files:
	testZEOOptions.py 
Log Message:
ZConfig now supplies a platform-dependent default when a hostname isn't
specified for an address-type value.  The tests hardwired the Linux
default (an empty string), so failed on Windows (which uses 'localhost').


=== ZODB/src/ZEO/tests/testZEOOptions.py 1.1 => 1.2 ===
--- ZODB/src/ZEO/tests/testZEOOptions.py:1.1	Fri Jan 17 22:51:47 2003
+++ ZODB/src/ZEO/tests/testZEOOptions.py	Fri Feb 20 12:56:08 2004
@@ -25,6 +25,12 @@
 from ZEO.runzeo import ZEOOptions
 from zdaemon.tests.testzdoptions import TestZDOptions
 
+# When a hostname isn't specified in an address, ZConfig supplies a
+# platform-dependent default value.
+DEFAULT_HOSTNAME = ''
+if sys.platform in ['win32',]:
+    DEFAULT_HOSTNAME = 'localhost'
+
 class TestZEOOptions(TestZDOptions):
 
     OptionsClass = ZEOOptions
@@ -61,7 +67,7 @@
     def test_defaults_with_schema(self):
         options = self.OptionsClass()
         options.realize(["-C", self.tempfilename])
-        self.assertEqual(options.address, ("", 5555))
+        self.assertEqual(options.address, (DEFAULT_HOSTNAME, 5555))
         self.assertEqual(len(options.storages), 1)
         opener = options.storages[0]
         self.assertEqual(opener.name, "fs")
@@ -73,7 +79,7 @@
     def test_defaults_without_schema(self):
         options = self.OptionsClass()
         options.realize(["-a", "5555", "-f", "Data.fs"])
-        self.assertEqual(options.address, ("", 5555))
+        self.assertEqual(options.address, (DEFAULT_HOSTNAME, 5555))
         self.assertEqual(len(options.storages), 1)
         opener = options.storages[0]
         self.assertEqual(opener.name, "1")
@@ -87,7 +93,7 @@
         options = self.OptionsClass()
         options.realize(["-C", self.tempfilename,
                          "-a", "6666", "-f", "Wisdom.fs"])
-        self.assertEqual(options.address, ("", 6666))
+        self.assertEqual(options.address, (DEFAULT_HOSTNAME, 6666))
         self.assertEqual(len(options.storages), 1)
         opener = options.storages[0]
         self.assertEqual(opener.__class__, ZODB.config.FileStorage)




More information about the Zope-Checkins mailing list