Skip to content

Commit

Permalink
Use self.io_loop in with_timeout tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajdavis authored and bdarnell committed Feb 1, 2015
1 parent eb4649e commit 2716458
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tornado/test/gen_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ def test_completes_before_timeout(self):
self.io_loop.add_timeout(datetime.timedelta(seconds=0.1),
lambda: future.set_result('asdf'))
result = yield gen.with_timeout(datetime.timedelta(seconds=3600),
future)
future, io_loop=self.io_loop)
self.assertEqual(result, 'asdf')

@gen_test
Expand All @@ -1046,14 +1046,15 @@ def test_fails_before_timeout(self):
datetime.timedelta(seconds=0.1),
lambda: future.set_exception(ZeroDivisionError()))
with self.assertRaises(ZeroDivisionError):
yield gen.with_timeout(datetime.timedelta(seconds=3600), future)
yield gen.with_timeout(datetime.timedelta(seconds=3600),
future, io_loop=self.io_loop)

@gen_test
def test_already_resolved(self):
future = Future()
future.set_result('asdf')
result = yield gen.with_timeout(datetime.timedelta(seconds=3600),
future)
future, io_loop=self.io_loop)
self.assertEqual(result, 'asdf')

@unittest.skipIf(futures is None, 'futures module not present')
Expand Down

0 comments on commit 2716458

Please sign in to comment.