def setUp(self): DictionaryTest.setUp(self) # build dictionary dataPath = [ util.getDataPath(), os.path.join('.', 'test'), os.path.join('.', 'test', 'downloads') ] self.builder = DatabaseBuilder(quiet=True, dbConnectInst=self.db, dataPath=dataPath, rebuildExisting=True, noFail=False) self.builder.build(self.DICTIONARY) self.dictionary = self.dictionaryClass(dbConnectInst=self.db)
def setUp(self): prefer = [self.BUILDER] prefer.extend(self.PREFER_BUILDERS) self.dataPath = self.EXTERNAL_DATA_PATHS[:] self.dataPath.append(util.getDataPath()) self.dataPath.append(os.path.join('.', 'test')) self.dataPath.append(os.path.join('.', 'test', 'downloads')) self.dbInstances = {} for databasePath in self.DATABASES: self.dbInstances[databasePath] = DatabaseBuilder(quiet=True, databaseUrl=databasePath, dataPath=self.dataPath, prefer=prefer, rebuildExisting=True, noFail=False) # make sure we don't get a production db instance tables = self.dbInstances[databasePath].db.engine.table_names() assert len(tables) == 0, "Database is not empty: '%s'" \ % "', '".join(tables)
def setUp(self): DictionaryTest.setUp(self) builderClasses = DatabaseBuilder.getTableBuilderClasses(quiet=True) dictionaryBuilder = [ cls for cls in builderClasses if cls.PROVIDES == self.table ][0] contentBuilder = new.classobj( "SimpleDictBuilder", (DictionaryResultTest._ContentGenerator, dictionaryBuilder), {'content': self.INSTALL_CONTENT}) self.builder = DatabaseBuilder(quiet=True, dbConnectInst=self.db, additionalBuilders=[contentBuilder], prefer=["SimpleDictBuilder"], rebuildExisting=True, noFail=False) self.builder.build(self.DICTIONARY) assert self.db.mainHasTable(self.DICTIONARY) self.dictionary = self.dictionaryClass(dbConnectInst=self.db, **self.DICTIONARY_OPTIONS)