本文整理汇总了Python中test_all.test_support.rmtree函数的典型用法代码示例。如果您正苦于以下问题:Python rmtree函数的具体用法?Python rmtree怎么用?Python rmtree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rmtree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tearDown
def tearDown(self):
import sys
if sys.version_info[0] >= 3 :
from test_all import do_proxy_db_py3k
do_proxy_db_py3k(self._flag_proxy_db_py3k)
self.do_close()
test_support.rmtree(self.homeDir)
示例2: 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()
示例3: 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
示例4: tearDown
def tearDown(self):
if self.dbClient:
self.dbClient.close()
if self.dbMaster:
self.dbMaster.close()
self.m2c.put(None)
self.c2m.put(None)
self.t_m.join()
self.t_c.join()
# Here we assign dummy event handlers to allow GC of the test object.
# Since the dummy handler doesn't use any outer scope variable, it
# doesn't keep any reference to the test object.
def dummy(*args):
pass
self.dbenvMaster.set_event_notify(dummy)
self.dbenvClient.set_event_notify(dummy)
self.dbenvMaster.rep_set_transport(13, dummy)
self.dbenvClient.rep_set_transport(3, dummy)
self.dbenvClient.close()
self.dbenvMaster.close()
test_support.rmtree(self.homeDirClient)
test_support.rmtree(self.homeDirMaster)
示例5: tearDown
def tearDown(self):
self.closeDB()
if self.env is not None:
self.env.close()
self.env = None
test_support.rmtree(self.homeDir)
return
示例6: tearDown
def tearDown(self):
self.d.close()
if self.env is not None:
self.env.close()
test_support.rmtree(self.homeDir)
else:
os.remove(self.filename)
示例7: tearDown
def tearDown(self):
self.secondary_db.close()
self.primary_db.close()
self.env.close()
del self.secondary_db
del self.primary_db
del self.env
test_support.rmtree(self.homeDir)
示例8: tearDown
def tearDown(self):
if self.dbClient :
self.dbClient.close()
if self.dbMaster :
self.dbMaster.close()
self.dbenvClient.close()
self.dbenvMaster.close()
test_support.rmtree(self.homeDirClient)
test_support.rmtree(self.homeDirMaster)
示例9: tearDown
def tearDown(self):
if hasattr(self, "seq"):
self.seq.close()
del self.seq
if hasattr(self, "d"):
self.d.close()
del self.d
if hasattr(self, "dbenv"):
self.dbenv.close()
del self.dbenv
test_support.rmtree(self.homeDir)
示例10: tearDown
def tearDown(self):
self.db.close()
del self.db
self.env.close()
del self.env
test_support.rmtree(self.homeDir)
def test_flags(self):
self.db.set_flags(db.DB_CHKSUM)
self.assertEqual(db.DB_CHKSUM, self.db.get_flags())
self.db.set_flags(db.DB_TXN_NOT_DURABLE)
self.assertEqual(db.DB_TXN_NOT_DURABLE | db.DB_CHKSUM, self.db.get_flags())
示例11: tearDown
def tearDown(self):
if self.dbClient:
self.dbClient.close()
if self.dbMaster:
self.dbMaster.close()
def dummy(*args):
pass
self.dbenvMaster.set_event_notify(dummy)
self.dbenvClient.set_event_notify(dummy)
self.dbenvClient.close()
self.dbenvMaster.close()
test_support.rmtree(self.homeDirClient)
test_support.rmtree(self.homeDirMaster)
示例12: 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()
示例13: tearDown
def tearDown(self):
test_support.unlink(self.db_path_1)
test_support.unlink(self.db_path_2)
test_support.rmtree(self.db_env_path)
示例14: tearDown
def tearDown(self):
test_support.rmtree(self.homeDir)
示例15: tearDown
def tearDown(self):
self.closeDB()
self.env.close()
self.env = None
test_support.rmtree(self.homeDir)