Пример #1
0
def test(init_db=True, coverage=True):
    """Run all tests.

    It will also initialize the test database and create code coverage report, unless
    specified otherwise. Database that will be used for tests can be specified in the
    application config file. See `TEST_SQLALCHEMY_DATABASE_URI` variable.

    Code coverage report will be located in cover/index.html file.
    """
    if init_db:
        # Creating database-related stuff
        init_postgres(create_app().config['TEST_SQLALCHEMY_DATABASE_URI'])

    if coverage:
        local(
            "nosetests --exe --with-coverage --cover-package=metabrainz --cover-erase --cover-html"
        )
        print(
            yellow("Coverage report can be found in cover/index.html file.",
                   bold=True))
    else:
        local("nosetests --exe")
Пример #2
0
def create_db():
    """Create and configure the database."""
    init_postgres(current_app.config['SQLALCHEMY_DATABASE_URI'])
Пример #3
0
def create_db():
    """Create and configure the database."""
    with application.app_context():
        init_postgres(application.config['SQLALCHEMY_DATABASE_URI'])
Пример #4
0
def create_db():
    """Create and configure the database."""
    with application.app_context():
        init_postgres(application.config['SQLALCHEMY_DATABASE_URI'])