[Zodb-checkins] CVS: ZODB3/zdaemon/tests - testzdrun.py:1.5

Guido van Rossum guido@python.org
Tue, 21 Jan 2003 13:19:43 -0500


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

Modified Files:
	testzdrun.py 
Log Message:
Make zdrun and zdctl share more configuration.

zrdun no longer has a "client" mode; you have to do that using zdctl.

This isn't completely cooked yet; I have disabled some tests that were
using zdrun's client mode until I find time to figure out how to
rewrite those tests.


=== ZODB3/zdaemon/tests/testzdrun.py 1.4 => 1.5 ===
--- ZODB3/zdaemon/tests/testzdrun.py:1.4	Mon Jan 20 14:40:50 2003
+++ ZODB3/zdaemon/tests/testzdrun.py	Tue Jan 21 13:19:40 2003
@@ -8,7 +8,7 @@
 import unittest
 from StringIO import StringIO
 
-from zdaemon import zdrun
+from zdaemon import zdrun, zdctl
 
 class ZDaemonTests(unittest.TestCase):
 
@@ -64,9 +64,8 @@
     def run(self, args):
         if type(args) is type(""):
             args = args.split()
-        d = zdrun.Daemonizer()
         try:
-            d.main(["-s", self.zdsock] + args)
+            zdctl.main(["-s", self.zdsock] + args)
         except SystemExit:
             pass
 
@@ -74,25 +73,25 @@
         self.rundaemon(["echo", "-n"])
         self.expect = ""
 
-    def testInvoke(self):
-        self.run("echo -n")
-        self.expect = ""
-
-    def testControl(self):
-        self.rundaemon(["sleep", "1000"])
-        time.sleep(1)
-        self.run("-c stop")
-        time.sleep(1)
-        self.run("-c exit")
-        self.expect = "Sent SIGTERM\nExiting now\n"
-
-    def testStop(self):
-        self.rundaemon([self.python, self.nokill])
-        time.sleep(1)
-        self.run("-c stop")
-        time.sleep(1)
-        self.run("-c exit")
-        self.expect = "Sent SIGTERM\nSent SIGTERM; will exit later\n"
+##     def testInvoke(self):
+##         self.run("echo -n")
+##         self.expect = ""
+
+##     def testControl(self):
+##         self.rundaemon(["sleep", "1000"])
+##         time.sleep(1)
+##         self.run("stop")
+##         time.sleep(1)
+##         self.run("exit")
+##         self.expect = "Sent SIGTERM\nExiting now\n"
+
+##     def testStop(self):
+##         self.rundaemon([self.python, self.nokill])
+##         time.sleep(1)
+##         self.run("stop")
+##         time.sleep(1)
+##         self.run("exit")
+##         self.expect = "Sent SIGTERM\nSent SIGTERM; will exit later\n"
 
     def testHelp(self):
         self.run("-h")
@@ -104,20 +103,18 @@
         options = zdrun.ZDRunOptions()
         save_sys_argv = sys.argv
         try:
-            sys.argv = ["A", "-c", "B", "C"]
+            sys.argv = ["A", "B", "C"]
             options.realize()
         finally:
             sys.argv = save_sys_argv
-        self.assertEqual(options.options, [("-c", "")])
-        self.assertEqual(options.isclient, 1)
+        self.assertEqual(options.options, [])
         self.assertEqual(options.args, ["B", "C"])
 
     def testOptionsBasic(self):
         # Check basic option parsing
         options = zdrun.ZDRunOptions()
-        options.realize(["-c", "B", "C"], "foo")
-        self.assertEqual(options.options, [("-c", "")])
-        self.assertEqual(options.isclient, 1)
+        options.realize(["B", "C"], "foo")
+        self.assertEqual(options.options, [])
         self.assertEqual(options.args, ["B", "C"])
         self.assertEqual(options.progname, "foo")
 
@@ -135,8 +132,8 @@
     def testSubprocessBasic(self):
         # Check basic subprocess management: spawn, kill, wait
         options = zdrun.ZDRunOptions()
-        options.realize([])
-        proc = zdrun.Subprocess(options, ["sleep", "100"])
+        options.realize(["sleep", "100"])
+        proc = zdrun.Subprocess(options)
         self.assertEqual(proc.pid, 0)
         pid = proc.spawn()
         self.assertEqual(proc.pid, pid)