[Zope-Checkins] CVS: ZODB3/zdaemon/tests - testzdrun.py:1.5.16.2
Jeremy Hylton
jeremy at zope.com
Mon Sep 15 14:03:26 EDT 2003
Update of /cvs-repository/ZODB3/zdaemon/tests
In directory cvs.zope.org:/tmp/cvs-serv13599/zdaemon/tests
Modified Files:
Tag: Zope-2_7-branch
testzdrun.py
Log Message:
Take two: Merge changes from ZODB3-3_2-branch to Zope-2_7-branch.
Please make all future changes on the Zope-2_7-branch instead.
The previous attempt used "cvs up -j ZODB3-3_2-branch", but appeared
to get only a small fraction of the changes. This attempt is based on
copying a checkout of ZODB3-3_2-branch over top of a checkout of
Zope-2_7-branch.
=== ZODB3/zdaemon/tests/testzdrun.py 1.5.16.1 => 1.5.16.2 ===
--- ZODB3/zdaemon/tests/testzdrun.py:1.5.16.1 Mon Jul 21 12:38:42 2003
+++ ZODB3/zdaemon/tests/testzdrun.py Mon Sep 15 14:02:54 2003
@@ -6,8 +6,8 @@
import signal
import tempfile
import unittest
-import socket
from StringIO import StringIO
+
from zdaemon import zdrun, zdctl
class ZDaemonTests(unittest.TestCase):
@@ -145,49 +145,6 @@
self.assertEqual(os.WTERMSIG(wsts), signal.SIGTERM)
proc.setstatus(wsts)
self.assertEqual(proc.pid, 0)
-
- def testRunIgnoresParentSignals(self):
- # Spawn a process which will in turn spawn a zdrun process.
- # We make sure that the zdrun process is still running even if
- # its parent process receives an interrupt signal (it should
- # not be passed to zdrun).
- zdrun_socket = os.path.join(self.here, 'testsock')
- zdctlpid = os.spawnvp(
- os.P_NOWAIT,
- sys.executable,
- [sys.executable, os.path.join(self.here, 'parent.py')]
- )
- time.sleep(2) # race condition possible here
- os.kill(zdctlpid, signal.SIGINT)
- try:
- response = send_action('status\n', zdrun_socket) or ''
- except socket.error, msg:
- response = ''
- params = response.split('\n')
- self.assert_(len(params) > 1)
- # kill the process
- send_action('exit\n', zdrun_socket)
-
-def send_action(action, sockname):
- """Send an action to the zdrun server and return the response.
-
- Return None if the server is not up or any other error happened.
- """
- sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
- try:
- sock.connect(sockname)
- sock.send(action + "\n")
- sock.shutdown(1) # We're not writing any more
- response = ""
- while 1:
- data = sock.recv(1000)
- if not data:
- break
- response += data
- sock.close()
- return response
- except socket.error, msg:
- return None
def test_suite():
suite = unittest.TestSuite()
More information about the Zope-Checkins
mailing list