From e8f8737dcd62d8a3ea602af6bf919272ddd78090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Eide?= Date: Fri, 17 Jan 2025 10:01:21 +0100 Subject: [PATCH] Simplify test --- tests/everest/test_detached.py | 52 +++++----------------------------- 1 file changed, 7 insertions(+), 45 deletions(-) diff --git a/tests/everest/test_detached.py b/tests/everest/test_detached.py index 0d8f2616aa5..523010aafd2 100644 --- a/tests/everest/test_detached.py +++ b/tests/everest/test_detached.py @@ -5,9 +5,10 @@ import pytest import requests +import yaml import everest -from ert.config import ErtConfig, QueueSystem +from ert.config import QueueSystem from ert.config.queue_config import ( LocalQueueOptions, LsfQueueOptions, @@ -20,7 +21,6 @@ from everest.config.server_config import ServerConfig from everest.config.simulator_config import SimulatorConfig from everest.detached import ( - _EVERSERVER_JOB_PATH, PROXY, ServerStatus, everserver_status, @@ -31,12 +31,6 @@ wait_for_server, wait_for_server_to_stop, ) -from everest.strings import ( - DEFAULT_OUTPUT_DIR, - DETACHED_NODE_DIR, - EVEREST_SERVER_CONFIG, - SIMULATION_DIR, -) from everest.util import makedirs_if_needed @@ -150,43 +144,11 @@ def test_wait_for_server(server_is_running_mock, caplog, monkeypatch): assert not caplog.messages -def _get_reference_config(): - everest_config = EverestConfig.load_file("config_minimal.yml") - reference_config = ErtConfig.read_site_config() - cwd = os.getcwd() - reference_config.update( - { - "INSTALL_JOB": [(EVEREST_SERVER_CONFIG, _EVERSERVER_JOB_PATH)], - "QUEUE_SYSTEM": "LOCAL", - "JOBNAME": EVEREST_SERVER_CONFIG, - "MAX_SUBMIT": 1, - "NUM_REALIZATIONS": 1, - "RUNPATH": os.path.join( - cwd, - DEFAULT_OUTPUT_DIR, - DETACHED_NODE_DIR, - SIMULATION_DIR, - ), - "FORWARD_MODEL": [ - [ - EVEREST_SERVER_CONFIG, - "--config-file", - os.path.join(cwd, "config_minimal.yml"), - ], - ], - "ENSPATH": os.path.join( - cwd, DEFAULT_OUTPUT_DIR, DETACHED_NODE_DIR, EVEREST_SERVER_CONFIG - ), - "RUNPATH_FILE": os.path.join( - cwd, DEFAULT_OUTPUT_DIR, DETACHED_NODE_DIR, ".res_runpath_list" - ), - } - ) - return everest_config, reference_config - - -def test_detached_mode_config_base(copy_math_func_test_data_to_tmp): - everest_config, _ = _get_reference_config() +def test_detached_mode_config_base(min_config, monkeypatch, tmp_path): + monkeypatch.chdir(tmp_path) + with open("config.yml", "w", encoding="utf-8") as fout: + yaml.dump(min_config, fout) + everest_config = EverestConfig.load_file("config.yml") assert everest_config.simulator.queue_system == LocalQueueOptions(max_running=8)