本文整理汇总了Python中multidb.pinning.this_thread_is_pinned函数的典型用法代码示例。如果您正苦于以下问题:Python this_thread_is_pinned函数的具体用法?Python this_thread_is_pinned怎么用?Python this_thread_is_pinned使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了this_thread_is_pinned函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pinning_encapsulation
def test_pinning_encapsulation(self):
"""Check the pinning getters and setters."""
self.assertFalse(this_thread_is_pinned())
pin_this_thread()
self.assertTrue(this_thread_is_pinned())
unpin_this_thread()
self.assertFalse(this_thread_is_pinned())
示例2: test_decorator_resets
def test_decorator_resets(self):
@use_master
def check():
assert this_thread_is_pinned()
pin_this_thread()
assert this_thread_is_pinned()
check()
assert this_thread_is_pinned()
示例3: test_decorator_resets
def test_decorator_resets(self):
@use_primary_db
def check():
assert this_thread_is_pinned()
pin_this_thread()
assert this_thread_is_pinned()
check()
assert this_thread_is_pinned()
示例4: test_decorator
def test_decorator(self):
@use_primary_db
def check():
assert this_thread_is_pinned()
unpin_this_thread()
assert not this_thread_is_pinned()
check()
assert not this_thread_is_pinned()
示例5: test_context_manager_exception
def test_context_manager_exception(self):
unpin_this_thread()
self.assertFalse(this_thread_is_pinned())
with self.assertRaises(ValueError):
with use_master:
self.assertTrue(this_thread_is_pinned())
raise ValueError
self.assertFalse(this_thread_is_pinned())
示例6: test_decorator
def test_decorator(self):
@use_master
def check():
assert this_thread_is_pinned()
unpin_this_thread()
assert not this_thread_is_pinned()
check()
assert not this_thread_is_pinned()
示例7: test_context_manager_exception
def test_context_manager_exception(self):
unpin_this_thread()
assert not this_thread_is_pinned()
with self.assertRaises(ValueError):
with use_master:
assert this_thread_is_pinned()
raise ValueError
assert not this_thread_is_pinned()
示例8: test_pinning_encapsulation
def test_pinning_encapsulation(self):
"""Check the pinning getters and setters."""
assert not this_thread_is_pinned(), "Thread started out pinned or this_thread_is_pinned() is broken."
pin_this_thread()
assert this_thread_is_pinned(), "pin_this_thread() didn't pin the thread."
unpin_this_thread()
assert not this_thread_is_pinned(), "Thread remained pinned after unpin_this_thread()."
示例9: test_context_manager_exception
def test_context_manager_exception(self):
unpin_this_thread()
try:
assert not this_thread_is_pinned()
with use_master:
assert this_thread_is_pinned()
raise ValueError
except ValueError:
pass
assert not this_thread_is_pinned()
示例10: test_decorator_resets
def test_decorator_resets(self):
@use_master
def check():
self.assertTrue(this_thread_is_pinned())
pin_this_thread()
self.assertTrue(this_thread_is_pinned())
check()
self.assertTrue(this_thread_is_pinned())
示例11: test_decorator
def test_decorator(self):
@use_master
def check():
self.assertTrue(this_thread_is_pinned())
unpin_this_thread()
self.assertFalse(this_thread_is_pinned())
check()
self.assertFalse(this_thread_is_pinned())
示例12: test_slave_decorator
def test_slave_decorator(self):
@use_slave
def check():
self.assertFalse(this_thread_is_pinned())
pin_this_thread()
self.assertTrue(this_thread_is_pinned())
check()
self.assertTrue(this_thread_is_pinned())
示例13: test_slave_decorator_resets
def test_slave_decorator_resets(self):
@use_slave
def check():
self.assertFalse(this_thread_is_pinned())
unpin_this_thread()
self.assertFalse(this_thread_is_pinned())
check()
self.assertFalse(this_thread_is_pinned())
示例14: test_failed_session_auth
def test_failed_session_auth(self):
req = RequestFactory().post(
'/',
HTTP_AUTHORIZATION='mkt-shared-secret bogus')
ok_(not self.auth.is_authenticated(req))
assert not getattr(req, 'amo_user', None)
ok_(not this_thread_is_pinned())
示例15: test_request_token_fake
def test_request_token_fake(self):
c = Mock()
c.key = self.access.key
c.secret = 'mom'
ok_(not self.auth.authenticate(
Request(self.call(client=OAuthClient(c)))))
ok_(not this_thread_is_pinned())