def test_dev_config(): """ Development config. """ app = create_app(DevConfig) assert app.config["ENV"] == "dev" assert app.config["DEBUG"] is True
def create_megaqc_app(): from megaqc.app import create_app from megaqc.settings import DevConfig, ProdConfig, TestConfig if env.bool("FLASK_DEBUG", False): CONFIG = DevConfig() elif env.bool("MEGAQC_PRODUCTION", False): CONFIG = ProdConfig() else: CONFIG = TestConfig() if settings.run_db_check: # Attempt to connect to the database exists to check that it exists try: dbengine = sqlalchemy.create_engine( CONFIG.SQLALCHEMY_DATABASE_URI).connect() metadata = sqlalchemy.MetaData(dbengine, reflect=True) assert "sample_data" in metadata.tables except: print( "\n##### ERROR! Could not find table 'sample_data' in database!" ) print( "Has the database been initialised? If not, please run 'megaqc initdb' first" ) print("Exiting...\n") sys.exit(1) else: dbengine.close() return create_app(CONFIG)
def test_production_config(): """ Production config. """ app = create_app(ProdConfig) assert app.config["ENV"] == "prod" assert app.config["DEBUG"] is False assert app.config["DEBUG_TB_ENABLED"] is False
def app(): """An application for the tests.""" _app = create_app(TestConfig) ctx = _app.test_request_context() ctx.push() yield _app ctx.pop()
def app(): """An application for the tests.""" config = TestConfig() init_db(config.SQLALCHEMY_DATABASE_URI) _app = create_app(config) ctx = _app.test_request_context() ctx.push() yield _app ctx.pop()
def create_megaqc_app(info): import os from megaqc.app import create_app from megaqc.settings import TestConfig, DevConfig, ProdConfig if os.environ.get("FLASK_DEBUG", False): CONFIG = DevConfig() elif os.environ.get("MEGAQC_PRODUCTION", False): CONFIG = ProdConfig() else: CONFIG = TestConfig() return create_app(CONFIG)
import os from megaqc.app import create_app from megaqc.settings import TestConfig, DevConfig, ProdConfig CONFIG = TestConfig() if os.environ.get('MEGAQC_DEBUG', False): CONFIG = DevConfig() elif os.environ.get('MEGAQC_PRODUCTION', False): CONFIG = ProdConfig() app = create_app(CONFIG)
def test_production_config(): """Production config.""" app = create_app(ProdConfig) assert app.config['ENV'] == 'prod' assert app.config['DEBUG'] is False assert app.config['DEBUG_TB_ENABLED'] is False
def test_dev_config(): """Development config.""" app = create_app(DevConfig) assert app.config['ENV'] == 'dev' assert app.config['DEBUG'] is True