Exemplo n.º 1
0
def test_use_master():
    local = context.multidb.pinning._locals
    eq_(getattr(local, 'pinned', False), False)
    with context.use_master():
        eq_(local.pinned, True)
        with context.use_master():
            eq_(local.pinned, True)
        eq_(local.pinned, True)
    eq_(local.pinned, False)
Exemplo n.º 2
0
def test_use_master():
    local = context.multidb.pinning._locals
    eq_(getattr(local, 'pinned', False), False)
    with context.use_master():
        eq_(local.pinned, True)
        with context.use_master():
            eq_(local.pinned, True)
        eq_(local.pinned, True)
    eq_(local.pinned, False)
Exemplo n.º 3
0
def test_use_master():
    multidb.pinning.unpin_this_thread()
    local = models.multidb.pinning._locals
    eq_(getattr(local, 'pinned', False), False)
    with models.use_master():
        eq_(local.pinned, True)
        with models.use_master():
            eq_(local.pinned, True)
        eq_(local.pinned, True)
    eq_(local.pinned, False)
Exemplo n.º 4
0
 def wrapper(*args, **kw):
     with models.use_master():
         return f(*args, **kw)
Exemplo n.º 5
0
 def wrapper(*args, **kw):
     with models.use_master():
         return f(*args, **kw)