[Zope-Checkins]
SVN: Zope/trunk/lib/python/zdaemon/tests/testzdrun.py
Try to repair testRunIgnoresParentSignals.
Tim Peters
tim.one at comcast.net
Fri Jan 21 17:22:53 EST 2005
Log message for revision 28912:
Try to repair testRunIgnoresParentSignals.
Instead of poke-and-hope guessing at how long to wait
for the child process to start running, use send_action()
in a loop to ask about that more directly -- but don't
wait longer than a minute.
The test should run faster on most boxes now, but
take up to a minute on boxes that are bogged down for
whatever reason.
Note that this checkin is being made from a wrong place!
zdaemon isn't part of the Zope tree, it's stitched in
from the zdaemon repository. So this checkin has no
effect on zdaemon. It will need to be sideported later
if it turns out to fix the overnight test failures.
Changed:
U Zope/trunk/lib/python/zdaemon/tests/testzdrun.py
-=-
Modified: Zope/trunk/lib/python/zdaemon/tests/testzdrun.py
===================================================================
--- Zope/trunk/lib/python/zdaemon/tests/testzdrun.py 2005-01-21 22:16:39 UTC (rev 28911)
+++ Zope/trunk/lib/python/zdaemon/tests/testzdrun.py 2005-01-21 22:22:52 UTC (rev 28912)
@@ -217,15 +217,24 @@
sys.executable,
[sys.executable, os.path.join(self.here, 'parent.py')]
)
- time.sleep(2) # race condition possible here
+ # Wait for it to start, but no longer than a minute.
+ deadline = time.time() + 60
+ is_started = False
+ while time.time() < deadline:
+ response = send_action('status\n', zdrun_socket)
+ if response is None:
+ time.sleep(0.05)
+ else:
+ is_started = True
+ break
+ self.assert_(is_started, "spawned process failed to start in a minute")
+ # Kill it, and wait a little to ensure it's dead.
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, repr(response))
- # kill the process
+ time.sleep(0.25)
+ # Make sure the child is still responsive.
+ response = send_action('status\n', zdrun_socket)
+ self.assert_(response is not None and '\n' in response)
+ # Kill the process.
send_action('exit\n', zdrun_socket)
def testUmask(self):
More information about the Zope-Checkins
mailing list