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")
def create_db(): """Create and configure the database.""" init_postgres(current_app.config['SQLALCHEMY_DATABASE_URI'])
def create_db(): """Create and configure the database.""" with application.app_context(): init_postgres(application.config['SQLALCHEMY_DATABASE_URI'])