Skip to content

Instantly share code, notes, and snippets.

@hellais
Created January 11, 2013 12:44
Show Gist options
  • Save hellais/4510391 to your computer and use it in GitHub Desktop.
Save hellais/4510391 to your computer and use it in GitHub Desktop.
from twisted.trial import unittest
from storm.twisted.transact import transact, Transactor
from storm.twisted.testing import FakeThreadPool
class Antani(object):
@transact
def antani(self):
return "foobar"
class TestAntani(unittest.TestCase):
def setUp(self):
self.threadpool = FakeThreadPool()
self.transactor = Transactor(self.threadpool)
def test_antani(self):
def cb(result):
print "callback"
print result
self.assertEqual(result, "foobar")
def eb(failure):
print "errback"
print failure
a = Antani()
a.transactor = self.transactor
d = a.antani()
d.addCallback(cb) # never called
d.addErrback(eb) # never called
return d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment