[Zope-Coders] Re: Zope tests: 4 OK, 2 Failed

Tim Peters tim.peters at gmail.com
Tue Jan 18 13:46:18 EST 2005


[Tim Peters, on testRunIgnoresParentSignals]
...
> *If* it's failing because spawnvp doesn't have time to get the new
> processes running, what actually happens in this test is that its
> first send_action() call suppresses a socket.error with a detail of
> the form
>
>    (2, 'No such file or directory')
>
> The test turns send_action's None return in that case into an
> empty string, and then splitting an empty string by '\n' yields
> the list
> 
>    ['']
> 
> and so
> 
>        self.assert_(len(params) > 1)
>
> triggers.  I'm guessing that is what's happening, too, but it's
> impossible to be sure of that now from the test's useless failure
> output.

And after you changed send_action() to stop suppressing socket.error,
the overnight test run failed like so:

ERROR: testRunIgnoresParentSignals (zdaemon.tests.testzdrun.ZDaemonTests)
----------------------------------------------------------------------
Traceback (most recent call last):
 File "/usr/local/python2.4/lib/python2.4/unittest.py", line 260, in run
   testMethod()
 File "/autotest/temp/python24-zope28/lib/python/zdaemon/tests/testzdrun.py",
line 223, in testRunIgnoresParentSignals
   response = send_action('status\n', zdrun_socket) or ''
 File "/autotest/temp/python24-zope28/lib/python/zdaemon/tests/testzdrun.py",
line 257, in send_action
   sock.connect(sockname)
 File "<string>", line 1, in connect
error: (2, 'No such file or directory')

Good (I guess <wink>).  The next question is why 2 seconds isn't long
enough to get the spawned processes running on this box.

Or maybe just boosting the sleep(2) in the test to, say, sleep(10),
would make the problem go away?  I don't care if the tests always take
8 seconds longer to run, if in return people can stop wasting time
wondering why this test sometimes fails.

A more principled approach would retry the connect() until it worked,
or until (say) a minute had passed.  On all boxes I've tried, sleep(1)
is long enough for the test to pass reliably.  Maybe you have a cron
job that sucks up a lot resources while your overnight tests are
running?


More information about the Zope-Coders mailing list