[Zope-Checkins] CVS: StandaloneZODB/Tools/tests - testzeopack.py:1.6

Jeremy Hylton jeremy@zope.com
Wed, 30 Jan 2002 17:10:48 -0500


Update of /cvs-repository/StandaloneZODB/Tools/tests
In directory cvs.zope.org:/tmp/cvs-serv4950/Tools/tests

Modified Files:
	testzeopack.py 
Log Message:
Add test of -W option


=== StandaloneZODB/Tools/tests/testzeopack.py 1.5 => 1.6 ===
 # Some simple tests for zeopack.py
 # For this to work, zeopack.py must by on your PATH.
 
@@ -9,6 +10,8 @@
 import os
 import socket
 import tempfile
+import threading
+import time
 import unittest
 
 # XXX The forker interface isn't clearly defined.  It's different on
@@ -47,7 +50,8 @@
         try:
             os.waitpid(self.pid, 0)
         except os.error, err:
-            print err
+            ##print "waitpid failed", err
+            pass
         for ext in '', '.old', '.lock', '.index', '.tmp':
             path = self.path + ext
             try:
@@ -86,6 +90,19 @@
     def testNoServer(self):
         status = os.system("zeopack.py -p 19")
         assert status != 0
+
+    def testWaitForServer(self):
+        self.set_inet_addr()
+        def delayed_start():
+            time.sleep(11)
+            self.start()
+        t = threading.Thread(target=delayed_start)
+        t.start()
+        status = os.system("zeopack.py -h %s -p %s -W" % (self.host,
+                                                          self.port))
+        t.join()
+        assert status == 0
+        assert os.path.exists(self.path + ".old")
 
 class UpTest(unittest.TestCase):