Fix TwistedIOLoop on python 2.6.

This commit is contained in:
Ben Darnell 2013-03-08 19:03:49 -05:00
parent 20afb40419
commit 7431ffe1a0
2 changed files with 11 additions and 1 deletions

View File

@ -472,7 +472,7 @@ class TwistedIOLoop(tornado.ioloop.IOLoop):
if isinstance(deadline, (int, long, float)):
delay = max(deadline - self.time(), 0)
elif isinstance(deadline, datetime.timedelta):
delay = deadline.total_seconds()
delay = tornado.ioloop._Timeout.timedelta_to_seconds(deadline)
else:
raise TypeError("Unsupported deadline %r")
return self.reactor.callLater(delay, self._run_callback, wrap(callback))

10
tox.ini
View File

@ -71,6 +71,16 @@ deps =
twisted>=12.0.0
commands = python -m tornado.test.runtests --ioloop=tornado.platform.select.SelectIOLoop {posargs:}
[testenv:py26-twisted]
basepython = python2.6
deps =
futures
mock
pycurl
twisted>=12.3.0
unittest2
commands = python -m tornado.test.runtests --ioloop=tornado.platform.twisted.TwistedIOLoop {posargs:}
[testenv:py27-twisted]
basepython = python2.7
deps =