Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
 def create_db(self):
     from targetexplorer.flaskapp import db, app
     app.config.update(SQLALCHEMY_DATABASE_URI=self.sqlalchemy_database_uri)
     db.create_all()
Exemplo n.º 4
0
 def create_db(self):
     from targetexplorer.flaskapp import db, app
     app.config.update(
         SQLALCHEMY_DATABASE_URI=self.sqlalchemy_database_uri
     )
     db.create_all()