本文整理汇总了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
示例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()
示例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()
示例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()
示例5: setUp
def setUp(self):
self.filename = get_new_database_path()
self.homeDir = get_new_environment_path()
示例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()
示例7: setUp
def setUp(self):
self.filename = get_new_database_path()
示例8: setUp
def setUp(self):
self.filename = get_new_database_path()
self.homeDir = None
示例9: setUp
def setUp(self):
self.path = get_new_database_path()
self.db = db.DB()