Esempio n. 1
0
def setup_test_db():
    """ Setup a database which can be used with any tests involving the DB.
        It is assumed that calling this functions has no side-effects and
        no cleanup (eg, deleting files) is required afterwards. """
    if not db.connected:
        db.connect("sqlite:///:memory:", debug=False)
        db.create_tables()
Esempio n. 2
0
def setup_test_db():
    """ Setup a database which can be used with any tests involving the DB.
        It is assumed that calling this functions has no side-effects and
        no cleanup (eg, deleting files) is required afterwards. """
    if not db.connected:
        db.connect("sqlite:///:memory:", debug=False)
        db.create_tables()
Esempio n. 3
0
File: env.py Progetto: nsi-iff/pyOLS
    def load(self, p, c):
        """ Load the environment from path 'p' with config options 'c'.
            An exception will be raised if there is something wrong with it
            (version is too old, it doesn't exist, etc). """
        if not path.exists(p):
            raise PyolsNotFound("The environment path '%s' does not exist. "
                                "Create it with '-c'?" % (p))
        self._path = p

        self.assert_env_version()

        config.load(self.path('config.ini'))
        config.update(c)

        log.reconfigure(config, self.path('pyols.log'))

        # Note: The DB path is hard-coded here for two reasons:
        #       0) I cannot think of any good reason to change it
        #       1) It would involve more code to get the environment
        #          path into the config parser.
        db.connect('sqlite:///' + self.path('pyOLS.sqlite3'),
                   debug=config['log_level'] == 'debug')
Esempio n. 4
0
File: env.py Progetto: nsi-iff/pyOLS
    def load(self, p, c):
        """ Load the environment from path 'p' with config options 'c'.
            An exception will be raised if there is something wrong with it
            (version is too old, it doesn't exist, etc). """
        if not path.exists(p):
            raise PyolsNotFound("The environment path '%s' does not exist. "
                                "Create it with '-c'?" %(p))
        self._path = p

        self.assert_env_version()
        
        config.load(self.path('config.ini'))
        config.update(c)

        log.reconfigure(config, self.path('pyols.log'))

        # Note: The DB path is hard-coded here for two reasons:
        #       0) I cannot think of any good reason to change it
        #       1) It would involve more code to get the environment
        #          path into the config parser.
        db.connect('sqlite:///'+self.path('pyOLS.sqlite3'),
                   debug=config['log_level'] == 'debug')