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


Python test_all.get_new_database_path函数代码示例

本文整理汇总了Python中test_all.get_new_database_path函数的典型用法代码示例。如果您正苦于以下问题:Python get_new_database_path函数的具体用法?Python get_new_database_path怎么用?Python get_new_database_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: setUp

    def setUp(self):
        if self.useEnv:
            self.homeDir = get_new_environment_path()
            try:
                self.env = db.DBEnv()
                self.env.set_lg_max(1048576)
                self.env.set_tx_max(30)
                self._t = int(time.time())
                self.env.set_tx_timestamp(self._t)
                self.env.set_flags(self.envsetflags, 1)
                self.env.open(self.homeDir, self.envflags | db.DB_CREATE)
                self.filename = 'test'
            except:
                test_support.rmtree(self.homeDir)
                raise

        else:
            self.env = None
            self.filename = get_new_database_path()
        self.d = db.DB(self.env)
        if not self.useEnv:
            self.d.set_cachesize(*self.cachesize)
            cachesize = self.d.get_cachesize()
            self.assertEqual(cachesize[0], self.cachesize[0])
            self.assertEqual(cachesize[2], self.cachesize[2])
            self.assertEqual(125, int(100.0 * cachesize[1] / self.cachesize[1]))
        self.d.set_flags(self.dbsetflags)
        if self.dbname:
            self.d.open(self.filename, self.dbname, self.dbtype, self.dbopenflags | db.DB_CREATE, self.dbmode)
        else:
            self.d.open(self.filename, mode=self.dbmode, dbtype=self.dbtype, flags=self.dbopenflags | db.DB_CREATE)
        if not self.useEnv:
            self.assertRaises(db.DBInvalidArgError, self.d.set_cachesize, *self.cachesize)
        self.populateDB()
        return
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:35,代码来源:test_basics.py

示例2: setUp

 def setUp(self):
     import sys
     if sys.version_info[0] >= 3 :
         from test_all import do_proxy_db_py3k
         self._flag_proxy_db_py3k = do_proxy_db_py3k(False)
     self.filename = get_new_database_path()
     self.do_open()
开发者ID:AojiaoZero,项目名称:CrossApp,代码行数:7,代码来源:test_dbshelve.py

示例3: setUp

    def setUp(self):
        if self.useEnv:
            self.homeDir = get_new_environment_path()
            try:
                self.env = db.DBEnv()
                self.env.set_lg_max(1024 * 1024)
                self.env.set_tx_max(30)
                self.env.set_tx_timestamp(int(time.time()))
                self.env.set_flags(self.envsetflags, 1)
                self.env.open(self.homeDir, self.envflags | db.DB_CREATE)
                self.filename = "test"
            # Yes, a bare except is intended, since we're re-raising the exc.
            except:
                test_support.rmtree(self.homeDir)
                raise
        else:
            self.env = None
            self.filename = get_new_database_path()

        # create and open the DB
        self.d = db.DB(self.env)
        self.d.set_flags(self.dbsetflags)
        if self.dbname:
            self.d.open(self.filename, self.dbname, self.dbtype,
                        self.dbopenflags | db.DB_CREATE, self.dbmode)
        else:
            self.d.open(
                self.filename,  # try out keyword args
                mode=self.dbmode,
                dbtype=self.dbtype,
                flags=self.dbopenflags | db.DB_CREATE)

        self.populateDB()
开发者ID:Rogerlin2013,项目名称:CrossApp,代码行数:33,代码来源:test_basics.py

示例4: setUp

    def setUp(self):
        if self.useEnv:
            self.homeDir=get_new_environment_path()
            try:
                self.env = db.DBEnv()
                self.env.set_lg_max(1024*1024)
                self.env.set_tx_max(30)
                self._t = int(time.time())
                self.env.set_tx_timestamp(self._t)
                self.env.set_flags(self.envsetflags, 1)
                self.env.open(self.homeDir, self.envflags | db.DB_CREATE)
                self.filename = "test"
            # Yes, a bare except is intended, since we're re-raising the exc.
            except:
                test_support.rmtree(self.homeDir)
                raise
        else:
            self.env = None
            self.filename = get_new_database_path()

        # create and open the DB
        self.d = db.DB(self.env)
        if not self.useEnv :
            if db.version() >= (4, 2) :
                self.d.set_cachesize(*self.cachesize)
                cachesize = self.d.get_cachesize()
                self.assertEqual(cachesize[0], self.cachesize[0])
                self.assertEqual(cachesize[2], self.cachesize[2])
                # Berkeley DB expands the cache 25% accounting overhead,
                # if the cache is small.
                self.assertEqual(125, int(100.0*cachesize[1]/self.cachesize[1]))
        self.d.set_flags(self.dbsetflags)
        if self.dbname:
            self.d.open(self.filename, self.dbname, self.dbtype,
                        self.dbopenflags|db.DB_CREATE, self.dbmode)
        else:
            self.d.open(self.filename,   # try out keyword args
                        mode = self.dbmode,
                        dbtype = self.dbtype,
                        flags = self.dbopenflags|db.DB_CREATE)

        if not self.useEnv:
            self.assertRaises(db.DBInvalidArgError,
                    self.d.set_cachesize, *self.cachesize)

        self.populateDB()
开发者ID:kanbang,项目名称:Colt,代码行数:46,代码来源:test_basics.py

示例5: setUp

 def setUp(self):
     self.filename = get_new_database_path()
     self.homeDir = get_new_environment_path()
开发者ID:webiumsk,项目名称:WOT-0.9.15.1,代码行数:3,代码来源:test_misc.py

示例6: setUp

 def setUp(self):
     self.db_path_1 = get_new_database_path()
     self.db_path_2 = get_new_database_path()
     self.db_env_path = get_new_environment_path()
开发者ID:2uller,项目名称:LotF,代码行数:4,代码来源:test_fileid.py

示例7: setUp

 def setUp(self):
     self.filename = get_new_database_path()
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:2,代码来源:test_queue.py

示例8: setUp

 def setUp(self):
     self.filename = get_new_database_path()
     self.homeDir = None
开发者ID:DecipherOne,项目名称:Troglodyte,代码行数:3,代码来源:test_recno.py

示例9: setUp

 def setUp(self):
     self.path = get_new_database_path()
     self.db = db.DB()
开发者ID:ktan2020,项目名称:legacy-automation,代码行数:3,代码来源:test_db.py


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