def set_cur_profile(self, profile): self.__cur_prof = profile cpool.cpool_release() if profile is None: return db_fname = None if profile.db_fname: db_fname = profile.db_fname else: db_fname = path.join(self.prof_dir, profile.id) cpool.cpool_init(db_fname, 5)
def setUp(self): db_fname = './da_test_db' supp.gen_db(db_fname) cpool.cpool_release() cpool.cpool_init(db_fname, 5) self.pada = da.ProfileAttrDA() row = ('nonsense_name', 'nonsense_value') self.pada.begin_transaction() self.pada.save_row(row) self.pada.end_transaction()
def setUp(self): db_fname = './da_test_db' supp.gen_db(db_fname) cpool.cpool_release() cpool.cpool_init(db_fname, 5) self.lfda = da.LocalFileDA() self.file_hash = 'file_hash' self.seg_hashs = ('seg_hash0', 'seg_hash1') row = (self.file_hash, 'full_name', 'name', 4096, '2009-01-01 09:09:09', 7168) seg_row0 = (self.seg_hashs[0], 0, self.file_hash, True) seg_row1 = (self.seg_hashs[1], 4096, self.file_hash, False) self.lfda.begin_transaction() self.lfda.save_row(row) self.lfda.save_seg_row(seg_row0) self.lfda.save_seg_row(seg_row1) self.lfda.end_transaction()
def testInitRelease(self): cpool.cpool_init('./cpool_test_db', 99) self.assertTrue(isinstance(cpool.get_cpool(), cpool.ConnectionPool)) cpool.cpool_release() self.assertEqual(cpool.get_cpool(), None)
def tearDown(self): db_fname = './entity_test_db' cpool.cpool_release() if os.path.isfile(db_fname): os.remove(db_fname)
def tearDown(self): db_fname = './da_test_db' del self.pada cpool.cpool_release() if os.path.isfile(db_fname): os.remove(db_fname)
def setUp(self): db_fname = './da_test_db' supp.gen_db(db_fname) cpool.cpool_release() cpool.cpool_init(db_fname, 5)