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)
예제 #2
0
def get_new_environment_path() :
    path=get_new_path("environment")
    import os
    try:
        os.makedirs(path,mode=0o700)
    except os.error:
        test_support.rmtree(path)
        os.makedirs(path)
    return path
예제 #3
0
def get_new_environment_path() :
    path=get_new_path("environment")
    import os
    try:
        os.makedirs(path,mode=0700)
    except os.error:
        test_support.rmtree(path)
        os.makedirs(path)
    return path
예제 #4
0
    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)
예제 #5
0
 def tearDown(self):
     self.d.close()
     if self.env is not None:
         self.env.close()
         test_support.rmtree(self.homeDir)
         ## XXX(nnorwitz): is this comment stil valid?
         ## Make a new DBEnv to remove the env files from the home dir.
         ## (It can't be done while the env is open, nor after it has been
         ## closed, so we make a new one to do it.)
         #e = db.DBEnv()
         #e.remove(self.homeDir)
         #os.remove(os.path.join(self.homeDir, self.filename))
     else:
         os.remove(self.filename)
예제 #6
0
    def setUp(self):
        if self.useEnv:
            homeDir = os.path.join(tempfile.gettempdir(), 'db_home%d'%os.getpid())
            self.homeDir = homeDir
            test_support.rmtree(homeDir)
            os.mkdir(homeDir)
            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(homeDir, self.envflags | db.DB_CREATE)
                tempfile.tempdir = homeDir
                self.filename = os.path.split(tempfile.mktemp())[1]
                tempfile.tempdir = None
            # Yes, a bare except is intended, since we're re-raising the exc.
            except:
                test_support.rmtree(homeDir)
                raise
        else:
            self.env = None
            self.filename = tempfile.mktemp()

        # 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()
예제 #7
0
def remove_test_path_directory() :
    test_support.rmtree(get_new_path.prefix)
예제 #8
0
def remove_test_path_directory():
    test_support.rmtree(get_new_path.prefix)
예제 #9
0
 def tearDown(self):
     self.d.close()
     self.env.close()
     test_support.rmtree(self.homeDir)
예제 #10
0
 def tearDown(self):
     if hasattr(self, 'db'):
         del self.db
     if hasattr(self, 'env'):
         del self.env
     test_support.rmtree(self.homeDir)
예제 #11
0
 def tearDown(self):
     test_support.unlink(self.filename)
     if self.homeDir:
         test_support.rmtree(self.homeDir)
예제 #12
0
 def tearDown(self):
     self.tdb.close()
     test_support.rmtree(self.testHomeDir)
예제 #13
0
 def tearDown(self):
     self.do_close()
     test_support.rmtree(self.homeDir)
예제 #14
0
 def tearDown (self):
     self.closeDB ()
     if self.env is not None:
         self.env.close ()
         self.env = None
     test_support.rmtree(self.homeDir)
예제 #15
0
 def tearDown(self):
     test_support.rmtree(self.homeDir)