示例#1
0
    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):
        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)
示例#3
0
    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)
示例#4
0
    def getDefaultOptions(cls, includeConfig=True):
        """
        Gets default options that always overwrite those specified in the build
        module. Boolean options of the :class:`~cjklib.build.DatabaseBuilder`
        can not be changed here as they are hardcoded in the given command line
        options.
        """
        options = {}
        # dataPath
        options['dataPath'] = ['.', getDataPath()]
        # prefer
        options['prefer'] = cls.DB_PREFER_BUILDERS[:]

        if includeConfig:
            options.update(cls.getConnectionConfigSettings())
            options.update(cls.getBuilderConfigSettings())

        return options
示例#5
0
文件: build.py 项目: KentVu/cjklib
    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)
示例#6
0
文件: cli.py 项目: Phil-V/cjklib
    def getDefaultOptions(cls, includeConfig=True):
        """
        Gets default options that always overwrite those specified in the build
        module. Boolean options of the :class:`~cjklib.build.DatabaseBuilder`
        can not be changed here as they are hardcoded in the given command line
        options.
        """
        options = {}
        # dataPath
        options["dataPath"] = [".", getDataPath()]
        # prefer
        options["prefer"] = cls.DB_PREFER_BUILDERS[:]

        if includeConfig:
            options.update(cls.getConnectionConfigSettings())
            options.update(cls.getBuilderConfigSettings())

        return options