[Zodb-checkins] CVS: ZODB3/zdaemon/tests - testzdaemon.py:1.7

Guido van Rossum guido@python.org
Tue, 26 Nov 2002 18:42:08 -0500


Update of /cvs-repository/ZODB3/zdaemon/tests
In directory cvs.zope.org:/tmp/cvs-serv30210

Modified Files:
	testzdaemon.py 
Log Message:
Quote arguments to rundaemon().  The args argument now *must* be a
list.


=== ZODB3/zdaemon/tests/testzdaemon.py 1.6 => 1.7 ===
--- ZODB3/zdaemon/tests/testzdaemon.py:1.6	Thu Nov 21 17:25:36 2002
+++ ZODB3/zdaemon/tests/testzdaemon.py	Tue Nov 26 18:42:07 2002
@@ -45,15 +45,20 @@
         output = self.new_stdout.getvalue()
         self.assertEqual(self.expect, output)
 
+    def quoteargs(self, args):
+        for i in range(len(args)):
+            if " " in args[i]:
+                args[i] = '"%s"' % args[i]
+        return " ".join(args)
+
     def rundaemon(self, args):
-        if type(args) is type([]):
-            args = " ".join(args)
+        args = self.quoteargs(args)
         cmd = ("PYTHONPATH=%s %s %s -d -s %s %s" %
                (self.ppath, self.python, self.zdaemon, self.zdsock, args))
         os.system(cmd)
         # When the daemon crashes, the following may help debug it:
         ##os.system("PYTHONPATH=%s %s %s -s %s %s &" %
-        ##          (self.ppath, self.python, self.zdaemon, self.zdsock, args))
+        ##    (self.ppath, self.python, self.zdaemon, self.zdsock, args))
 
     def run(self, args):
         if type(args) is type(""):
@@ -65,7 +70,7 @@
             pass
 
     def testSystem(self):
-        self.rundaemon("echo -n")
+        self.rundaemon(["echo", "-n"])
         self.expect = ""
 
     def testInvoke(self):
@@ -73,7 +78,7 @@
         self.expect = ""
 
     def testControl(self):
-        self.rundaemon("sleep 1000")
+        self.rundaemon(["sleep", "1000"])
         time.sleep(1)
         self.run("-c stop")
         time.sleep(1)