def test_alwaysTransaction():
    """hub.getConnection always returns a Transaction"""
    hub = database.AutoConnectHub("sqlite:///:memory:")
    try:
        assert isinstance(hub.getConnection(), dbconnection.Transaction)
        database.end_all()
        assert not isinstance(hub.threadingLocal.connection, dbconnection.Transaction)
    finally:
        database.hub_registry.clear()
Esempio n. 2
0
def test_alwaysTransaction():
    """hub.getConnection always returns a Transaction"""
    hub = database.AutoConnectHub("sqlite:///:memory:")
    try:
        assert isinstance(hub.getConnection(), dbconnection.Transaction)
        database.end_all()
        assert not isinstance(hub.threadingLocal.connection,
                              dbconnection.Transaction)
    finally:
        database.hub_registry.clear()
Esempio n. 3
0
 def __call__(self, *args, **kw):
     applogger.debug("schedSafe: begin")
     hub.threadingLocal = threading_local()
     hub.begin()
     try:
         ret = self.f(*args, **kw)
         applogger.debug("schedSafe: %s returned %s" % (self.f.__name__, ret))
     finally:
         commit_all()
         end_all()
     applogger.debug("schedSafe: done")
Esempio n. 4
0
def test_alwaysTransaction():
    "hub.getConnection always returns a Transaction"
    assert isinstance(hub.getConnection(), dbconnection.Transaction)
    database.end_all()
    assert not isinstance(hub.threadingLocal.connection, dbconnection.Transaction)