def test_client(): testing_client = app.test_client() initialize_app(testing_client) testing_client.testing = True # This code generates a h2o model to be used for running predictions # against the iris dataset h2o.init() training_frame = h2o.import_file(os.path.join(model_cache_dir, 'iris.csv')) estimator = H2OGradientBoostingEstimator() estimator.train( training_frame=training_frame, x=['sepal_length', 'sepal_width', 'petal_length', 'petal_width'], y='species') model_file = estimator.download_mojo(path=model_cache_dir, get_genmodel_jar=True, genmodel_name='h2o-genmodel.jar') model_dir = os.path.join(model_cache_dir, '1_0') with zipfile.ZipFile(os.path.join(model_dir, 'h2o'), 'w') as zip: zip.write(model_file, os.path.basename(model_file)) zip.write(os.path.join(model_cache_dir, 'h2o-genmodel.jar'), 'h2o-genmodel.jar') return testing_client
import sys from os.path import dirname, realpath, join from flask import Flask from microservice_flask import initialize_app from unittest.mock import patch parentddir = dirname(dirname(dirname(realpath(__file__)))) sys.path.append(join(parentddir, 'acumosintegrationservice')) BASE_URL = 'http://127.0.0.1:5000/v2/' app = Flask(__name__) initialize_app(app) ''' @pytest.fixture(scope='session') def test_client(): testing_client = app.test_client() initialize_app(testing_client) testing_client.testing = True return testing_client ''' @patch('acumosintegrationservice.api.acumos_e5_api.AcumosE5API.get_model_list') def test_get_solutions(get_model_list): get_model_list.return_value = { 'solutions': [