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()
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()
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
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()
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()
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()
def setUp(self): self.filename = get_new_database_path()
def setUp(self): self.path = get_new_database_path() self.db = db.DB()
def setUp(self): self.filename = get_new_database_path() self.homeDir = None
def setUp(self): self.filename = get_new_database_path() self.homeDir = get_new_environment_path()
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()