On Thu, Feb 9, 2012 at 7:30 AM, Ben Darnell <b
...@bendarnell.com> wrote:
> This is a bug. The timeout feature was designed to catch runaway
> tests that would otherwise run forever, so the timeout for any one
> call to wait() was expected to be longer than the entire running time
> of its test case. AsyncTestCase.wait should save the timeout handle
> it creates and cancel it before returning.
> -Ben
> On Wed, Feb 8, 2012 at 11:30 AM, bergundy <roey.ber...@gmail.com> wrote:
> > Consider the following test code:
> > ----
> > from tornado.testing import AsyncTestCase
> > import time
> > class TestWait(AsyncTestCase):
> > def test_1(self):
> > self.io_loop.add_timeout(time.time() + 1, self.stop)
> > self.wait(timeout = 2)
> > self.io_loop.add_timeout(time.time() + 2, self.stop)
> > self.wait(timeout = 5)
> > ----
> > When calling wait() the second time, the first timeout is still set in
> > the ioloop which causes the test to fail with the following traceback:
> > -----
> > Traceback (most recent call last):
> > File "/home/bergundy/test_wait.py", line 9, in test_1
> > self.wait(timeout = 5)
> > File "/netapp/dist/centos_5/i686/lib/python2.7/site-packages/tornado/
> > testing.py", line 169, in timeout_func
> > timeout)
> > AssertionError: Async operation timed out after 2 seconds
> > -----
> > Is this intended behavior? Am I doing something wrong?