def projecttest_context(set_up_project_stage='init'): """ Context manager used within TargetExplorer testing framework. Uses the SetUpSampleProject class to set up a TargetExplorer database at various points of completion, within a temporary directory set up by the nose plugin `setup_tmp_db_plugin`. The following command will set up the database at the point after retrieval of UniProt data: >>> with projecttest_context(set_up_project_stage='uniprot'): >>> ... See docs for SetUpSampleProject for other stages which can be set up. """ # Set up with open(installation_testdir_filepath) as installation_testdir_file: temp_dir = installation_testdir_file.read() cwd = os.getcwd() os.chdir(temp_dir) set_up_sample_project(stage=set_up_project_stage) # Test is run at this point yield temp_dir # Tear down db.drop_all() db.create_all() os.chdir(cwd)
def create_db(self): from targetexplorer.flaskapp import db, app app.config.update(SQLALCHEMY_DATABASE_URI=self.sqlalchemy_database_uri) db.create_all()
def create_db(self): from targetexplorer.flaskapp import db, app app.config.update( SQLALCHEMY_DATABASE_URI=self.sqlalchemy_database_uri ) db.create_all()