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


Python Database.disconnect方法代码示例

本文整理汇总了Python中mongotor.database.Database.disconnect方法的典型用法代码示例。如果您正苦于以下问题:Python Database.disconnect方法的具体用法?Python Database.disconnect怎么用?Python Database.disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mongotor.database.Database的用法示例。


在下文中一共展示了Database.disconnect方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: tearDown

# 需要导入模块: from mongotor.database import Database [as 别名]
# 或者: from mongotor.database.Database import disconnect [as 别名]
    def tearDown(self):
        super(SignalTestCase, self).tearDown()

        class CollectionTest(Collection):
            __collection__ = "collection_test"

        CollectionTest.objects.truncate(callback=self.stop)
        self.wait()
        Database.disconnect()
开发者ID:sansa1839,项目名称:mongotor,代码行数:11,代码来源:test_signal.py

示例2: tearDown

# 需要导入模块: from mongotor.database import Database [as 别名]
# 或者: from mongotor.database.Database import disconnect [as 别名]
    def tearDown(self):
        super(CursorTestCase, self).tearDown()

        # delete all documents
        message_delete = message.delete('mongotor_test.cursor_test',
            {}, True, {})
        Database().send_message(message_delete, callback=self.stop)
        self.wait()

        Database.disconnect()
开发者ID:sansa1839,项目名称:mongotor,代码行数:12,代码来源:test_cursor.py

示例3: test_raises_erro_when_use_collection_with_not_initialized_database

# 需要导入模块: from mongotor.database import Database [as 别名]
# 或者: from mongotor.database.Database import disconnect [as 别名]
    def test_raises_erro_when_use_collection_with_not_initialized_database(self):
        """[CollectionTestCase] - Raises DatabaseError when use collection with a not initialized database"""

        class CollectionTest(Collection):
            __collection__ = 'collection_test'

        Database.disconnect()
        CollectionTest().save.when.called_with(callback=None) \
            .throw(DatabaseError, 'you must be initialize database before perform this action')

        Database.init(["localhost:27027", "localhost:27028"], dbname='test')
开发者ID:Arion-Dsh,项目名称:mongotor,代码行数:13,代码来源:test_collection.py

示例4: tearDown

# 需要导入模块: from mongotor.database import Database [as 别名]
# 或者: from mongotor.database.Database import disconnect [as 别名]
    def tearDown(self):
        super(CursorTestCase, self).tearDown()

        # delete all documents
        message_delete = message.delete('mongotor_test.cursor_test',
            {}, True, {})

        node = Database().get_node(ReadPreference.PRIMARY)
        node.connection(self.stop)
        connection = self.wait()

        connection.send_message(message_delete, with_last_error=True, callback=self.stop)
        self.wait()

        Database.disconnect()
开发者ID:abdelouahabb,项目名称:mongotor,代码行数:17,代码来源:test_cursor.py

示例5: test_check_connections_when_use_cursors

# 需要导入模块: from mongotor.database import Database [as 别名]
# 或者: from mongotor.database.Database import disconnect [as 别名]
    def test_check_connections_when_use_cursors(self):
        """[ConnectionPoolTestCase] - check connections when use cursors"""
        db = Database.init('localhost:27027', dbname='test', maxconnections=10, maxusage=29)

        try:
            for i in range(2):
                db.cards.insert({'_id': ObjectId(), 'range': i}, callback=self.stop)
                self.wait()

            db._nodes[0].pool._connections.should.be.equal(0)

            db.cards.find({}, callback=self.stop)
            self.wait()

            db._nodes[0].pool._connections.should.be.equal(0)
        finally:
            Database.disconnect()
开发者ID:Arion-Dsh,项目名称:mongotor,代码行数:19,代码来源:test_pool.py

示例6: tearDown

# 需要导入模块: from mongotor.database import Database [as 别名]
# 或者: from mongotor.database.Database import disconnect [as 别名]
 def tearDown(self):
     super(ManagerTestCase, self).tearDown()
     CollectionTest.objects.truncate(callback=self.stop)
     self.wait()
     Database.disconnect()
开发者ID:sansa1839,项目名称:mongotor,代码行数:7,代码来源:test_manager.py

示例7: tearDown

# 需要导入模块: from mongotor.database import Database [as 别名]
# 或者: from mongotor.database.Database import disconnect [as 别名]
 def tearDown(self):
     super(ReplicaSetTestCase, self).tearDown()
     Database.disconnect()
开发者ID:sansa1839,项目名称:mongotor,代码行数:5,代码来源:test_replicaset.py

示例8: test_disconnect_database

# 需要导入模块: from mongotor.database import Database [as 别名]
# 或者: from mongotor.database.Database import disconnect [as 别名]
    def test_disconnect_database(self):
        """[DatabaseTestCase] - Disconnect the database"""
        Database.connect(["localhost:27027"], dbname="test")
        Database.disconnect()

        Database._instance.should.be.none
开发者ID:robert-zaremba,项目名称:mongotor,代码行数:8,代码来源:test_database.py

示例9: tearDown

# 需要导入模块: from mongotor.database import Database [as 别名]
# 或者: from mongotor.database.Database import disconnect [as 别名]
 def tearDown(self):
     super(CollectionTestCase, self).tearDown()
     Database.disconnect()
开发者ID:Arion-Dsh,项目名称:mongotor,代码行数:5,代码来源:test_collection.py


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