def init_db(application): """ Initialize the store database with some orders. """ with application.app_context(): if not os.path.exists(application.instance_path): os.makedirs(application.instance_path) init_database()
def setUp(self): self.market_app = create_application() self.db_fd, self.market_app.config['DATABASE'] = tempfile.mkstemp() self.market_app.config['TESTING'] = True with self.market_app.app_context(): init_database() self.client = self.market_app.test_client()
def setUp(self): self.instance_directory = tempfile.mkdtemp() config_file = os.path.join(self.instance_directory, 'application.cfg') with open(config_file, 'w') as fh: fh.write("INSTRUMENT = 'test_instrument'") self.market_app = create_application(self.instance_directory) self.market_app.testing = True self.db_fd, self.market_app.config['DATABASE'] = tempfile.mkstemp() self.market_app.config['TESTING'] = True self.app = self.market_app.test_client() with self.market_app.app_context(): init_database()