[issue7042] test_signal fails on os x 10.6

Mark Dickinson report at bugs.python.org
Mon Oct 5 10:36:13 CEST 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

> If this is about passing time, there should be better ways (than
> those which break if your computer gets faster).

Agreed.  The challenge is to find ways that don't add too much in the
way of extra complexity, fragility, or dependencies to the unit test.

How about replacing the xrange(100000000) loop with something like this,
which allows 30 seconds of real time and then fails with a timeout 
message:

start_time = time.time()
while time.time() - start_time < 5.0:
    <use some process time here>
    if signal.getitimer(self.itimer) == (0.0, 0.0):
        break
else:
    self.fail('timeout waiting for virtual timer signal')

----------
assignee:  -> mark.dickinson

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7042>
_______________________________________


More information about the Python-bugs-list mailing list