当前位置: 首页>>代码示例>>Python>>正文


Python pinning.this_thread_is_pinned函数代码示例

本文整理汇总了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())
开发者ID:wikical,项目名称:django-multidb-router,代码行数:7,代码来源:test_all.py

示例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()
开发者ID:mapmyfitness,项目名称:django-multidb-router,代码行数:8,代码来源:__init__.py

示例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()
开发者ID:jbalogh,项目名称:django-multidb-router,代码行数:8,代码来源:tests.py

示例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()
开发者ID:jbalogh,项目名称:django-multidb-router,代码行数:8,代码来源:tests.py

示例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())
开发者ID:wikical,项目名称:django-multidb-router,代码行数:8,代码来源:test_all.py

示例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()
开发者ID:mapmyfitness,项目名称:django-multidb-router,代码行数:8,代码来源:__init__.py

示例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()
开发者ID:mapmyfitness,项目名称:django-multidb-router,代码行数:8,代码来源:__init__.py

示例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()."
开发者ID:Mondego,项目名称:pyreco,代码行数:9,代码来源:allPythonContent.py

示例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()
开发者ID:Marlburo,项目名称:inventory,代码行数:10,代码来源:__init__.py

示例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())
开发者ID:wikical,项目名称:django-multidb-router,代码行数:10,代码来源:test_all.py

示例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())
开发者ID:wikical,项目名称:django-multidb-router,代码行数:10,代码来源:test_all.py

示例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())
开发者ID:clearcare,项目名称:django-multidb-router,代码行数:10,代码来源:test_all.py

示例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())
开发者ID:clearcare,项目名称:django-multidb-router,代码行数:10,代码来源:test_all.py

示例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())
开发者ID:aricha,项目名称:zamboni,代码行数:7,代码来源:test_authentication.py

示例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())
开发者ID:aricha,项目名称:zamboni,代码行数:7,代码来源:test_authentication.py


注:本文中的multidb.pinning.this_thread_is_pinned函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。