[Zodb-checkins] SVN: zdaemon/trunk/src/zdaemon/ Version 2.0.3 broke support for relative paths to the socket (``-s`` option and ``socket-name`` parameter), now relative paths work again as in version 2.0.2.
Michael Howitz
mh at gocept.com
Mon Apr 20 03:33:20 EDT 2009
Log message for revision 99307:
Version 2.0.3 broke support for relative paths to the socket (``-s`` option and ``socket-name`` parameter), now relative paths work again as in version 2.0.2.
Changed:
U zdaemon/trunk/src/zdaemon/tests/testzdoptions.py
U zdaemon/trunk/src/zdaemon/tests/testzdrun.py
U zdaemon/trunk/src/zdaemon/zdoptions.py
-=-
Modified: zdaemon/trunk/src/zdaemon/tests/testzdoptions.py
===================================================================
--- zdaemon/trunk/src/zdaemon/tests/testzdoptions.py 2009-04-20 07:25:23 UTC (rev 99306)
+++ zdaemon/trunk/src/zdaemon/tests/testzdoptions.py 2009-04-20 07:33:20 UTC (rev 99307)
@@ -102,7 +102,7 @@
self.fail("%s didn't call sys.exit()" % repr(arg))
helptext = self.stdout.getvalue()
self.assertEqual(helptext, expected)
-
+
def test_default_help(self):
# test what happens if OptionsClass is used directly.
# Not sure this ever happens :-S
@@ -113,7 +113,7 @@
# with __doc__
class SubClass(self.OptionsClass):
pass
- # __doc__ isn't inherited :-(
+ # __doc__ isn't inherited :-(
self.help_test_helper(SubClass,{},'No help available.')
def test_default_help_with_doc_kw(self):
@@ -126,7 +126,7 @@
class NoHelp(self.OptionsClass):
__doc__ = None
self.help_test_helper(NoHelp,{},'No help available.')
-
+
def test_no_help_with_doc_kw(self):
# test what happens when the subclass has None for __doc__,
# but doc is supplied to realize
@@ -139,7 +139,7 @@
class HasHelp(self.OptionsClass):
__doc__ = 'Some help'
self.help_test_helper(HasHelp,{},'Some help')
-
+
def test_no_help_with_doc_kw(self):
# test what happens when the subclass has None for __doc__,
# but doc is supplied to realize
@@ -389,6 +389,8 @@
os.path.join(self.root, 'sock')))
self.assertTrue(existing_parent_dirpath(
os.path.join(self.root, 'not-there', 'sock')))
+ self.assertTrue(existing_parent_dirpath(
+ os.path.join('not-there', 'sock')))
self.assertRaises(
ValueError, existing_parent_dirpath,
os.path.join(self.root, 'not-there', 'this-also-not', 'sock'))
Modified: zdaemon/trunk/src/zdaemon/tests/testzdrun.py
===================================================================
--- zdaemon/trunk/src/zdaemon/tests/testzdrun.py 2009-04-20 07:25:23 UTC (rev 99306)
+++ zdaemon/trunk/src/zdaemon/tests/testzdrun.py 2009-04-20 07:33:20 UTC (rev 99307)
@@ -261,7 +261,7 @@
I am root!
Do not run the tests as root.
Testing proper umask handling cannot be done as root.
-Furthermore, it is not a good idea and strongly discouraged to run zope, the
+Furthermore, it is not a good idea and strongly discouraged to run zope, the
build system (configure, make) or the tests as root.
In general do not run anything as root unless absolutely necessary.
""" )
@@ -344,6 +344,12 @@
self.run_ctl(['-s', path, '-p', self.cmd])
self.assert_(os.path.exists(os.path.dirname(path)))
+ def testCtlSocketDirectoryCreationRelativePath(self):
+ path = os.path.join('rundir', 'sock')
+ self.run_ctl(['-s', path, '-p', self.cmd])
+ self.assert_(os.path.exists(os.path.dirname(os.path.join(os.getcwd(),
+ path))))
+
def testCtlSocketDirectoryCreationOnlyOne(self):
path = os.path.join(self.root, 'rundir', 'not-created', 'sock')
self.assertRaises(SystemExit,
@@ -362,6 +368,15 @@
self.run_ctl(['-C', config])
self.assert_(os.path.exists(path))
+ def testCtlSocketDirectoryCreationFromConfigFileRelativePath(self):
+ path = 'rel-rundir'
+ options = ['socket-name %s/sock' % path,
+ 'program ' + self.cmd]
+ config = self.writeConfig(
+ '<runner>\n%s\n</runner>' % '\n'.join(options))
+ self.run_ctl(['-C', config])
+ self.assert_(os.path.exists(os.path.join(os.getcwd(), path)))
+
def writeConfig(self, config):
config_file = os.path.join(self.root, 'config')
open(config_file, 'w').write(config)
Modified: zdaemon/trunk/src/zdaemon/zdoptions.py
===================================================================
--- zdaemon/trunk/src/zdaemon/zdoptions.py 2009-04-20 07:25:23 UTC (rev 99306)
+++ zdaemon/trunk/src/zdaemon/zdoptions.py 2009-04-20 07:33:20 UTC (rev 99307)
@@ -35,7 +35,7 @@
configuration option default_to_interactive is set to false). Use the
action "help" to find out about available actions.
"""
-
+
doc = None
progname = None
configfile = None
@@ -450,10 +450,10 @@
def existing_parent_dirpath(arg):
path = os.path.expanduser(arg)
dir = os.path.dirname(path)
- if not dir:
- # relative pathname with no directory component
+ parent, tail = os.path.split(dir)
+ if not parent:
+ # relative pathname
return path
- parent, tail = os.path.split(dir)
if os.path.isdir(parent):
return path
raise ValueError('The directory named as part of the path %s '
More information about the Zodb-checkins
mailing list