From 574f2cfc060f420c98c3a59bc26c5d339d5c4b40 Mon Sep 17 00:00:00 2001 From: StephanDeHoop Date: Tue, 17 Dec 2024 14:25:54 +0100 Subject: [PATCH] Small cleanup --- tests/everest/test_everserver.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tests/everest/test_everserver.py b/tests/everest/test_everserver.py index fe557dee76a..8782100e6e5 100644 --- a/tests/everest/test_everserver.py +++ b/tests/everest/test_everserver.py @@ -5,11 +5,10 @@ from pathlib import Path from unittest.mock import patch -import yaml from ropt.enums import OptimizerExitCode from seba_sqlite.snapshot import SebaSnapshot -from everest.config import EverestConfig, ServerConfig +from everest.config import EverestConfig, OptimizationConfig, ServerConfig from everest.detached import ServerStatus, everserver_status from everest.detached.jobs import everserver from everest.simulator import JOB_FAILURE, JOB_SUCCESS @@ -237,7 +236,7 @@ def test_everserver_status_exception( assert "Exception: Failed optimization" in status["message"] -@patch("sys.argv", ["name", "--config-file", "config.yml"]) +@patch("sys.argv", ["name", "--config-file", "config_minimal.yml"]) @patch("everest.detached.jobs.everserver._configure_loggers") @patch("everest.detached.jobs.everserver._generate_authentication") @patch( @@ -257,13 +256,11 @@ def test_everserver_status_exception( def test_everserver_status_max_batch_num( _1, _2, _3, _4, _5, _6, _7, copy_math_func_test_data_to_tmp ): - with open("config_minimal.yml", encoding="utf-8") as file: - config = yaml.safe_load(file) - config["optimization"] = {"algorithm": "optpp_q_newton", "max_batch_num": 1} - - with open("config.yml", "w", encoding="utf-8") as fout: - yaml.dump(config, fout) - config = EverestConfig.load_file("config.yml") + config = EverestConfig.load_file("config_minimal.yml") + config.optimization = OptimizationConfig( + algorithm="optpp_q_newton", max_batch_num=1 + ) + config.dump("config_minimal.yml") everserver.main() status = everserver_status(