Skip to content

Instantly share code, notes, and snippets.

@ralphm
Created April 6, 2015 21:17
Show Gist options
  • Save ralphm/3c9412421f73cb3c51bc to your computer and use it in GitHub Desktop.
Save ralphm/3c9412421f73cb3c51bc to your computer and use it in GitHub Desktop.
from twisted.internet import defer, reactor
from twisted.python import log
from twisted.trial.unittest import TestCase
class Tests(TestCase):
timeout = 5
def tearDown(self):
log.msg("hi")
def test_timeout(self):
d = defer.Deferred()
cl = reactor.callLater(self.timeout + 1, d.callback, None)
self.addCleanup(cl.cancel)
return d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment