Commit 6ca2ed8c authored by Tim Peters's avatar Tim Peters

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').
parent 884abc28
...@@ -25,6 +25,12 @@ import ZODB.config ...@@ -25,6 +25,12 @@ import ZODB.config
from ZEO.runzeo import ZEOOptions from ZEO.runzeo import ZEOOptions
from zdaemon.tests.testzdoptions import TestZDOptions 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): class TestZEOOptions(TestZDOptions):
OptionsClass = ZEOOptions OptionsClass = ZEOOptions
...@@ -61,7 +67,7 @@ class TestZEOOptions(TestZDOptions): ...@@ -61,7 +67,7 @@ class TestZEOOptions(TestZDOptions):
def test_defaults_with_schema(self): def test_defaults_with_schema(self):
options = self.OptionsClass() options = self.OptionsClass()
options.realize(["-C", self.tempfilename]) options.realize(["-C", self.tempfilename])
self.assertEqual(options.address, ("", 5555)) self.assertEqual(options.address, (DEFAULT_HOSTNAME, 5555))
self.assertEqual(len(options.storages), 1) self.assertEqual(len(options.storages), 1)
opener = options.storages[0] opener = options.storages[0]
self.assertEqual(opener.name, "fs") self.assertEqual(opener.name, "fs")
...@@ -73,7 +79,7 @@ class TestZEOOptions(TestZDOptions): ...@@ -73,7 +79,7 @@ class TestZEOOptions(TestZDOptions):
def test_defaults_without_schema(self): def test_defaults_without_schema(self):
options = self.OptionsClass() options = self.OptionsClass()
options.realize(["-a", "5555", "-f", "Data.fs"]) 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) self.assertEqual(len(options.storages), 1)
opener = options.storages[0] opener = options.storages[0]
self.assertEqual(opener.name, "1") self.assertEqual(opener.name, "1")
...@@ -87,7 +93,7 @@ class TestZEOOptions(TestZDOptions): ...@@ -87,7 +93,7 @@ class TestZEOOptions(TestZDOptions):
options = self.OptionsClass() options = self.OptionsClass()
options.realize(["-C", self.tempfilename, options.realize(["-C", self.tempfilename,
"-a", "6666", "-f", "Wisdom.fs"]) "-a", "6666", "-f", "Wisdom.fs"])
self.assertEqual(options.address, ("", 6666)) self.assertEqual(options.address, (DEFAULT_HOSTNAME, 6666))
self.assertEqual(len(options.storages), 1) self.assertEqual(len(options.storages), 1)
opener = options.storages[0] opener = options.storages[0]
self.assertEqual(opener.__class__, ZODB.config.FileStorage) self.assertEqual(opener.__class__, ZODB.config.FileStorage)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment