def test_no_leakage(self):
        testcase = self.DatabaseTestCase()

        class Dummy(BaseObject):
            __tablename__ = 'dummy'

            id = sqlalchemy.schema.Column(sqlalchemy.types.Integer(),
                    primary_key=True, autoincrement=True)

        try:
            testcase.setUp()
            Session.add(Dummy())
            testcase.tearDown()
            testcase.setUp()
            self.assertEqual(Session.query(Dummy).count(), 0)
        finally:
            testcase.tearDown()
Exemplo n.º 2
0
    def test_no_leakage(self):
        testcase = self.DatabaseTestCase()

        class Dummy(BaseObject):
            __tablename__ = 'dummy'

            id = sqlalchemy.schema.Column(sqlalchemy.types.Integer(),
                                          primary_key=True,
                                          autoincrement=True)

        try:
            testcase.setUp()
            Session.add(Dummy())
            testcase.tearDown()
            testcase.setUp()
            self.assertEqual(Session.query(Dummy).count(), 0)
        finally:
            testcase.tearDown()
Exemplo n.º 3
0
def enable_sql_two_phase_commit(config, enable=True):
    Session.configure(twophase=enable)
Exemplo n.º 4
0
def init_sqlalchemy(engine):
    """Initialise the SQLAlchemy models. This must be called before using
    using any of the SQLAlchemy managed the tables or classes in the model."""
    Session.configure(bind=engine)
    metadata.bind = engine
Exemplo n.º 5
0
def enable_sql_two_phase_commit(config, enable=True):
    Session.configure(twophase=enable)
Exemplo n.º 6
0
def init_sqlalchemy(engine):
    """Initialise the SQLAlchemy models. This must be called before using
    using any of the SQLAlchemy managed the tables or classes in the model."""
    Session.configure(bind=engine)
    metadata.bind = engine