def test(self): self.action = False store = MemoryStore(self.models) store.events.before_init_app += self.before_init_app store.init_app() eq_(self.action, True, "before_init_app was not executed")
class BaseTest(TestCase): models = [Car, AllVars] auto_create = True auto_init = True def setUp(self): if self.auto_init: self.store = MemoryStore(self.models) self.store.init_app() self.store.connect() if self.auto_create: self.store.create_all() def tearDown(self): if self.auto_create: self.store.destroy_all() if self.auto_init: self.store.disconnect() self.store.destroy_app()
def test(self): store = MemoryStore(self.models) store.init_app() store.events.before_something += self.test