From 193ddf26b6f2348b03d5f1277478eec6c32389bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Eide?= Date: Wed, 11 Sep 2024 08:59:16 +0200 Subject: [PATCH] Test fixes --- .github/workflows/run-tests-build-docs.yml | 3 +-- tests/everest/conftest.py | 23 +------------------ .../entry_points/test_config_branch_entry.py | 4 ++-- .../entry_points/test_everest_entry.py | 2 +- tests/everest/entry_points/test_everexport.py | 2 +- .../entry_points/test_visualization_entry.py | 2 +- .../functional/test_main_everest_entry.py | 17 +++++++------- tests/everest/functional/test_ui.py | 11 +++++---- tests/everest/test_api.py | 6 ++--- tests/everest/test_cache.py | 2 +- tests/everest/test_config_branch.py | 2 +- tests/everest/test_config_file_loader.py | 6 ++--- tests/everest/test_config_validation.py | 4 ++-- tests/everest/test_controls.py | 4 ++-- tests/everest/test_cvar.py | 2 +- tests/everest/test_detached.py | 2 +- tests/everest/test_discrete.py | 1 - tests/everest/test_egg_simulation.py | 4 ++-- tests/everest/test_environment.py | 4 ++-- tests/everest/test_everest_initialization.py | 2 +- tests/everest/test_everest_output.py | 2 +- tests/everest/test_everjobs_io.py | 2 +- tests/everest/test_everlint.py | 4 ++-- tests/everest/test_everserver.py | 6 ++--- tests/everest/test_export.py | 2 +- tests/everest/test_export_data_dialog.py | 6 ++--- tests/everest/test_fix_control.py | 1 - tests/everest/test_fm_plugins.py | 3 ++- .../everest/test_input_constraints_config.py | 1 - tests/everest/test_logging.py | 2 +- tests/everest/test_math_func.py | 2 +- tests/everest/test_multiobjective.py | 4 ++-- tests/everest/test_objective_type.py | 2 +- tests/everest/test_optimization_config.py | 2 +- tests/everest/test_output_constraints.py | 5 ++-- tests/everest/test_qt_dialogs_output.py | 5 ++-- tests/everest/test_queue_driver.py | 1 + tests/everest/test_repo_configs.py | 3 ++- tests/everest/test_res_initialization.py | 4 ++-- tests/everest/test_restart.py | 2 +- tests/everest/test_samplers.py | 2 +- tests/everest/test_seba_initialization.py | 6 ++--- tests/everest/test_shell_scripts.py | 1 - tests/everest/test_site_config_env.py | 1 + tests/everest/test_templating.py | 6 ++--- tests/everest/test_ui_run.py | 2 +- tests/everest/test_util.py | 4 ++-- tests/everest/test_well_tools.py | 2 +- tests/everest/test_wells.py | 2 +- tests/everest/test_workflows.py | 2 +- tests/everest/test_yaml_parser.py | 6 ++--- .../everest/unit/everest/bin/test_everload.py | 13 ++++++----- tests/everest/utils/__init__.py | 1 + .../utils/test_pydantic_doc_generation.py | 2 +- 54 files changed, 98 insertions(+), 114 deletions(-) diff --git a/.github/workflows/run-tests-build-docs.yml b/.github/workflows/run-tests-build-docs.yml index 8aba79cd60c..aef60fdec7f 100644 --- a/.github/workflows/run-tests-build-docs.yml +++ b/.github/workflows/run-tests-build-docs.yml @@ -17,7 +17,7 @@ env: jobs: tests: - name: "py_${{ matrix.python-version }}_ert-${{ matrix.ert_version }}_${{ matrix.test_type }}" + name: "py_${{ matrix.python-version }}_${{ matrix.test_type }}" timeout-minutes: 60 strategy: fail-fast: false @@ -25,7 +25,6 @@ jobs: python-version: ['3.8', '3.11', '3.12'] os: [ubuntu-22.04] test_type: ['doc', 'ui-test', 'test', 'integration-test', 'everest-models-test'] - ert_version: ['release', 'main'] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/tests/everest/conftest.py b/tests/everest/conftest.py index 635c3d75d73..750db654fb4 100644 --- a/tests/everest/conftest.py +++ b/tests/everest/conftest.py @@ -6,6 +6,7 @@ from typing import Callable, Dict, Iterator, Optional, Union import pytest + from everest.config.control_config import ControlConfig @@ -82,25 +83,3 @@ def control_config( config = deepcopy(control_data_no_variables) config["variables"] = request.param return ControlConfig.model_validate(config) - - -@pytest.fixture(scope="session", autouse=True) -def hide_window(request): - if request.config.getoption("--show-gui"): - yield - return - - old_value = os.environ.get("QT_QPA_PLATFORM") - if sys.platform == "darwin": - os.environ["QT_QPA_PLATFORM"] = "offscreen" - else: - os.environ["QT_QPA_PLATFORM"] = "minimal" - yield - if old_value is None: - del os.environ["QT_QPA_PLATFORM"] - else: - os.environ["QT_QPA_PLATFORM"] = old_value - - -def pytest_addoption(parser): - parser.addoption("--show-gui", action="store_true", default=False) diff --git a/tests/everest/entry_points/test_config_branch_entry.py b/tests/everest/entry_points/test_config_branch_entry.py index 51db617f8d0..9e168a5b18b 100644 --- a/tests/everest/entry_points/test_config_branch_entry.py +++ b/tests/everest/entry_points/test_config_branch_entry.py @@ -1,12 +1,12 @@ from os.path import exists from unittest.mock import PropertyMock, patch +from seba_sqlite.snapshot import SebaSnapshot + from everest.bin.config_branch_script import config_branch_entry from everest.config import EverestConfig from everest.config_file_loader import load_yaml from everest.config_keys import ConfigKeys as CK -from seba_sqlite.snapshot import SebaSnapshot - from tests.everest.utils import relpath, tmpdir CONFIG_PATH = relpath("..", "..", "examples", "math_func") diff --git a/tests/everest/entry_points/test_everest_entry.py b/tests/everest/entry_points/test_everest_entry.py index 9724d180d28..8f31758ff8b 100644 --- a/tests/everest/entry_points/test_everest_entry.py +++ b/tests/everest/entry_points/test_everest_entry.py @@ -3,6 +3,7 @@ from unittest.mock import PropertyMock, patch import pytest + from everest.bin.everest_script import everest_entry from everest.bin.kill_script import kill_entry from everest.bin.monitor_script import monitor_entry @@ -16,7 +17,6 @@ from everest.jobs import shell_commands from everest.simulator import JOB_SUCCESS from ieverest.bin.ieverest_script import ieverest_entry - from tests.everest.utils import capture_logger, capture_streams, relpath, tmpdir CONFIG_PATH = relpath("..", "..", "examples", "math_func") diff --git a/tests/everest/entry_points/test_everexport.py b/tests/everest/entry_points/test_everexport.py index 2d2c325dfc7..5480b9d67b9 100644 --- a/tests/everest/entry_points/test_everexport.py +++ b/tests/everest/entry_points/test_everexport.py @@ -4,12 +4,12 @@ import pandas as pd import pytest + from everest import ConfigKeys as CK from everest import MetaDataColumnNames as MDCN from everest.bin.everexport_script import everexport_entry from everest.bin.utils import ProgressBar from everest.config import EverestConfig - from tests.everest.utils import ( capture_logger, create_cached_mocked_test_case, diff --git a/tests/everest/entry_points/test_visualization_entry.py b/tests/everest/entry_points/test_visualization_entry.py index a124ec8dcda..353f4ce0983 100644 --- a/tests/everest/entry_points/test_visualization_entry.py +++ b/tests/everest/entry_points/test_visualization_entry.py @@ -2,10 +2,10 @@ from unittest.mock import PropertyMock, patch import pytest + from everest.bin.visualization_script import visualization_entry from everest.config import EverestConfig from everest.detached import ServerStatus - from tests.everest.utils import capture_streams, relpath CONFIG_PATH = relpath("..", "..", "examples", "math_func", "config_advanced.yml") diff --git a/tests/everest/functional/test_main_everest_entry.py b/tests/everest/functional/test_main_everest_entry.py index cff4dc041ab..08fb5724f62 100644 --- a/tests/everest/functional/test_main_everest_entry.py +++ b/tests/everest/functional/test_main_everest_entry.py @@ -2,6 +2,15 @@ from textwrap import dedent import pytest +from ruamel.yaml import YAML +from seba_sqlite.snapshot import SebaSnapshot +from tests.everest.utils import ( + capture_streams, + relpath, + skipif_no_everest_models, + tmpdir, +) + from everest import __version__ as everest_version from everest.bin.main import start_everest from everest.config import EverestConfig @@ -11,14 +20,6 @@ everserver_status, wait_for_context, ) -from ruamel.yaml import YAML -from seba_sqlite.snapshot import SebaSnapshot -from tests.everest.utils import ( - capture_streams, - relpath, - skipif_no_everest_models, - tmpdir, -) CONFIG_PATH = relpath("..", "..", "examples", "math_func") CONFIG_FILE_MINIMAL = "config_minimal.yml" diff --git a/tests/everest/functional/test_ui.py b/tests/everest/functional/test_ui.py index 4c693287983..d35e2ad1375 100644 --- a/tests/everest/functional/test_ui.py +++ b/tests/everest/functional/test_ui.py @@ -1,4 +1,10 @@ import pytest +from PyQt5.QtWidgets import QAction, QPushButton, QWidget +from qtpy.QtCore import Qt +from seba_sqlite.snapshot import SebaSnapshot +from tests.everest.dialogs_mocker import mock_dialogs_all +from tests.everest.utils import relpath, tmpdir + from everest.config import EverestConfig from everest.detached import ( ServerStatus, @@ -7,11 +13,6 @@ wait_for_context, ) from ieverest import IEverest -from PyQt5.QtWidgets import QAction, QPushButton, QWidget -from qtpy.QtCore import Qt -from seba_sqlite.snapshot import SebaSnapshot -from tests.everest.dialogs_mocker import mock_dialogs_all -from tests.everest.utils import relpath, tmpdir CONFIG_PATH = relpath("..", "..", "examples", "math_func") CONFIG_FILE_MINIMAL = "config_minimal.yml" diff --git a/tests/everest/test_api.py b/tests/everest/test_api.py index 951cfdaf4f7..16f53cc4987 100644 --- a/tests/everest/test_api.py +++ b/tests/everest/test_api.py @@ -3,13 +3,13 @@ import pandas as pd import pytest -from everest.api import EverestDataAPI -from everest.config import EverestConfig -from everest.detached import ServerStatus from pandas import Timestamp from seba_sqlite.database import ControlDefinition, Function from seba_sqlite.snapshot import Metadata, OptimizationInfo, SimulationInfo, Snapshot +from everest.api import EverestDataAPI +from everest.config import EverestConfig +from everest.detached import ServerStatus from tests.everest.utils import relpath, tmpdir # Global values used to create the mock snapshot. diff --git a/tests/everest/test_cache.py b/tests/everest/test_cache.py index e17db2c0026..a2e129e7d75 100644 --- a/tests/everest/test_cache.py +++ b/tests/everest/test_cache.py @@ -1,8 +1,8 @@ import numpy as np + from everest.config import EverestConfig from everest.simulator import Simulator from everest.suite import _EverestWorkflow - from tests.everest.utils import relpath, tmp CONFIG_PATH = relpath("..", "..", "examples", "math_func") diff --git a/tests/everest/test_config_branch.py b/tests/everest/test_config_branch.py index 6b658df79b8..5dec49844c0 100644 --- a/tests/everest/test_config_branch.py +++ b/tests/everest/test_config_branch.py @@ -1,11 +1,11 @@ import pytest + from everest.bin.config_branch_script import ( _updated_initial_guess, opt_controls_by_batch, ) from everest.config_file_loader import load_yaml from everest.config_keys import ConfigKeys as CK - from tests.everest.utils import relpath, tmpdir CONFIG_PATH = relpath("..", "..", "examples", "math_func") diff --git a/tests/everest/test_config_file_loader.py b/tests/everest/test_config_file_loader.py index 45f8b9838b1..d3e8ad03e13 100644 --- a/tests/everest/test_config_file_loader.py +++ b/tests/everest/test_config_file_loader.py @@ -3,12 +3,12 @@ from unittest.mock import patch import pytest -from everest import ConfigKeys as CK -from everest import config_file_loader as loader -from everest.config import EverestConfig from pydantic_core import ValidationError from ruamel.yaml import YAML +from everest import ConfigKeys as CK +from everest import config_file_loader as loader +from everest.config import EverestConfig from tests.everest.utils import relpath, tmpdir mocked_root = relpath(os.path.join("test_data", "mocked_test_case")) diff --git a/tests/everest/test_config_validation.py b/tests/everest/test_config_validation.py index 9d0ad6d616d..9df62fc872a 100644 --- a/tests/everest/test_config_validation.py +++ b/tests/everest/test_config_validation.py @@ -5,11 +5,11 @@ from typing import Any, Dict, List, Union import pytest +from pydantic import ValidationError + from everest.config import EverestConfig, ModelConfig from everest.config.control_variable_config import ControlVariableConfig from everest.config.sampler_config import SamplerConfig -from pydantic import ValidationError - from tests.everest.utils import tmpdir diff --git a/tests/everest/test_controls.py b/tests/everest/test_controls.py index 831abd7cd90..90650632122 100644 --- a/tests/everest/test_controls.py +++ b/tests/everest/test_controls.py @@ -5,6 +5,8 @@ from typing import List import pytest +from pydantic import ValidationError + from everest import ConfigKeys from everest.config import EverestConfig from everest.config.control_config import ControlConfig @@ -14,8 +16,6 @@ ) from everest.config.input_constraint_config import InputConstraintConfig from everest.config.well_config import WellConfig -from pydantic import ValidationError - from tests.everest.utils import relpath, tmp, tmpdir cfg_dir = relpath("test_data", "mocked_test_case") diff --git a/tests/everest/test_cvar.py b/tests/everest/test_cvar.py index 7a0d5a0263a..3a365bc0466 100644 --- a/tests/everest/test_cvar.py +++ b/tests/everest/test_cvar.py @@ -1,7 +1,7 @@ import pytest + from everest.config import EverestConfig from everest.suite import _EverestWorkflow - from tests.everest.utils import relpath, tmpdir CONFIG_PATH = relpath("..", "..", "examples", "math_func") diff --git a/tests/everest/test_detached.py b/tests/everest/test_detached.py index b8662684b76..a2dbbb777fb 100644 --- a/tests/everest/test_detached.py +++ b/tests/everest/test_detached.py @@ -4,6 +4,7 @@ import pytest import requests + from ert.config import ErtConfig, QueueSystem from ert.storage import open_storage from everest.config import EverestConfig @@ -35,7 +36,6 @@ SIMULATION_DIR, ) from everest.util import makedirs_if_needed - from tests.everest.utils import capture_logger, relpath, tmpdir diff --git a/tests/everest/test_discrete.py b/tests/everest/test_discrete.py index 4bcd43c1dac..d7adeaff3dd 100644 --- a/tests/everest/test_discrete.py +++ b/tests/everest/test_discrete.py @@ -1,6 +1,5 @@ from everest.config import EverestConfig from everest.suite import _EverestWorkflow - from tests.everest.utils import relpath, tmpdir CONFIG_PATH = relpath("..", "..", "examples", "math_func") diff --git a/tests/everest/test_egg_simulation.py b/tests/everest/test_egg_simulation.py index 46a7b682401..6a803e78af0 100644 --- a/tests/everest/test_egg_simulation.py +++ b/tests/everest/test_egg_simulation.py @@ -1,8 +1,9 @@ import json import os -import everest import pytest + +import everest from ert.config import ErtConfig, QueueSystem from everest.config import EverestConfig from everest.config.export_config import ExportConfig @@ -10,7 +11,6 @@ from everest.export import MetaDataColumnNames from everest.plugins.site_config_env import PluginSiteConfigEnv from everest.simulator.everest_to_ert import everest_to_ert_config - from tests.everest.utils import ( everest_default_jobs, hide_opm, diff --git a/tests/everest/test_environment.py b/tests/everest/test_environment.py index 18ae6cf2ab7..dbea05ae9df 100644 --- a/tests/everest/test_environment.py +++ b/tests/everest/test_environment.py @@ -1,10 +1,10 @@ import os -import everest import pytest + +import everest from everest.config import EverestConfig from everest.simulator.everest_to_ert import everest_to_ert_config - from tests.everest.utils import relpath, tmpdir root = os.path.join("..", "..", "examples", "math_func") diff --git a/tests/everest/test_everest_initialization.py b/tests/everest/test_everest_initialization.py index 5163fef9ae0..7803f6e2b68 100644 --- a/tests/everest/test_everest_initialization.py +++ b/tests/everest/test_everest_initialization.py @@ -1,9 +1,9 @@ import os import pytest + from everest.config import EverestConfig from everest.suite import _EverestWorkflow - from tests.everest.utils import relpath, tmp NO_PROJECT_RES = ( diff --git a/tests/everest/test_everest_output.py b/tests/everest/test_everest_output.py index f0a4ea21ff1..a4a99c70de3 100644 --- a/tests/everest/test_everest_output.py +++ b/tests/everest/test_everest_output.py @@ -4,6 +4,7 @@ from unittest.mock import patch import pytest + from ert.config import ErtConfig from ert.storage import open_storage from everest.config import EverestConfig @@ -15,7 +16,6 @@ ) from everest.suite import _EverestWorkflow from everest.util import makedirs_if_needed - from tests.everest.utils import relpath, tmpdir diff --git a/tests/everest/test_everjobs_io.py b/tests/everest/test_everjobs_io.py index 4c96aaefa8a..4207a6fdbed 100644 --- a/tests/everest/test_everjobs_io.py +++ b/tests/everest/test_everjobs_io.py @@ -1,10 +1,10 @@ import json import os -import everest import pytest from ruamel.yaml import YAML +import everest from tests.everest.utils import tmpdir diff --git a/tests/everest/test_everlint.py b/tests/everest/test_everlint.py index 90cf85e1dfe..dccd2556d09 100644 --- a/tests/everest/test_everlint.py +++ b/tests/everest/test_everlint.py @@ -2,13 +2,13 @@ import tempfile from pathlib import Path -import everest import pytest + +import everest from everest import ConfigKeys from everest.config import EverestConfig from everest.config_file_loader import yaml_file_to_substituted_config_dict from everest.util.forward_models import collect_forward_models - from tests.everest.test_config_validation import has_error from tests.everest.utils import relpath diff --git a/tests/everest/test_everserver.py b/tests/everest/test_everserver.py index aecefe9a654..24ed0331b13 100644 --- a/tests/everest/test_everserver.py +++ b/tests/everest/test_everserver.py @@ -3,14 +3,14 @@ from functools import partial from unittest.mock import patch +from ropt.enums import OptimizerExitCode +from seba_sqlite.snapshot import SebaSnapshot + from everest.config import EverestConfig from everest.detached import ServerStatus, everserver_status from everest.detached.jobs import everserver from everest.simulator import JOB_FAILURE, JOB_SUCCESS from everest.strings import OPT_FAILURE_REALIZATIONS, SIM_PROGRESS_ENDPOINT -from ropt.enums import OptimizerExitCode -from seba_sqlite.snapshot import SebaSnapshot - from tests.everest.utils import relpath, tmpdir diff --git a/tests/everest/test_export.py b/tests/everest/test_export.py index cb151b3760e..a5d9ca8fce1 100644 --- a/tests/everest/test_export.py +++ b/tests/everest/test_export.py @@ -3,12 +3,12 @@ import pandas as pd import pytest + from everest import filter_data from everest.bin.utils import export_with_progress from everest.config import EverestConfig from everest.config.export_config import ExportConfig from everest.export import export, validate_export - from tests.everest.utils import create_cached_mocked_test_case, relpath, tmpdir CONFIG_PATH = relpath("..", "..", "examples", "math_func") diff --git a/tests/everest/test_export_data_dialog.py b/tests/everest/test_export_data_dialog.py index 8e6104925d4..260ecfbce3d 100644 --- a/tests/everest/test_export_data_dialog.py +++ b/tests/everest/test_export_data_dialog.py @@ -2,12 +2,12 @@ from pathlib import Path import pytest -from everest.config.everest_config import EverestConfig -from ieverest import IEverest -from ieverest.widgets.export_data_dialog import ExportDataDialog from PyQt5.QtWidgets import QFileDialog, QMessageBox from qtpy.QtCore import Qt, QTimer +from everest.config.everest_config import EverestConfig +from ieverest import IEverest +from ieverest.widgets.export_data_dialog import ExportDataDialog from tests.everest.utils import tmpdir diff --git a/tests/everest/test_fix_control.py b/tests/everest/test_fix_control.py index 93f8c504d82..56e96220929 100644 --- a/tests/everest/test_fix_control.py +++ b/tests/everest/test_fix_control.py @@ -1,6 +1,5 @@ from everest.config import EverestConfig from everest.suite import _EverestWorkflow - from tests.everest.utils import relpath, tmpdir CONFIG_PATH = relpath("..", "..", "examples", "math_func") diff --git a/tests/everest/test_fm_plugins.py b/tests/everest/test_fm_plugins.py index 0d1b1a3bd1b..be1fae80582 100644 --- a/tests/everest/test_fm_plugins.py +++ b/tests/everest/test_fm_plugins.py @@ -4,10 +4,11 @@ import pluggy import pytest +from pydantic import BaseModel + from everest.plugins import hook_impl, hook_specs, hookimpl from everest.strings import EVEREST from everest.util.forward_models import collect_forward_models -from pydantic import BaseModel class MockPluginManager(pluggy.PluginManager): diff --git a/tests/everest/test_input_constraints_config.py b/tests/everest/test_input_constraints_config.py index 307b96925b3..50237199ea4 100644 --- a/tests/everest/test_input_constraints_config.py +++ b/tests/everest/test_input_constraints_config.py @@ -1,6 +1,5 @@ from everest import ConfigKeys from everest.config import EverestConfig - from tests.everest.utils import relpath diff --git a/tests/everest/test_logging.py b/tests/everest/test_logging.py index 7536c000ada..c18b9cd0eb3 100644 --- a/tests/everest/test_logging.py +++ b/tests/everest/test_logging.py @@ -1,6 +1,7 @@ import os import pytest + from ert.config import ErtConfig from ert.storage import open_storage from everest.config import EverestConfig @@ -12,7 +13,6 @@ wait_for_server, ) from everest.util import makedirs_if_needed - from tests.everest.utils import relpath, tmpdir CONFIG_PATH = relpath("..", "..", "examples", "math_func") diff --git a/tests/everest/test_math_func.py b/tests/everest/test_math_func.py index a9f038a17f1..040cea1b862 100644 --- a/tests/everest/test_math_func.py +++ b/tests/everest/test_math_func.py @@ -4,13 +4,13 @@ import numpy as np import pandas as pd import pytest + from everest import ConfigKeys as CK from everest.config import EverestConfig from everest.config.export_config import ExportConfig from everest.export import export from everest.suite import _EverestWorkflow from everest.util import makedirs_if_needed - from tests.everest.utils import relpath, tmpdir CONFIG_PATH = relpath("..", "..", "examples", "math_func") diff --git a/tests/everest/test_multiobjective.py b/tests/everest/test_multiobjective.py index 16f1cc9778a..d743a07c1f9 100644 --- a/tests/everest/test_multiobjective.py +++ b/tests/everest/test_multiobjective.py @@ -1,11 +1,11 @@ import pytest +from ropt.config.enopt import EnOptConfig + from ert.config import ErtConfig from everest.config import EverestConfig from everest.optimizer.everest2ropt import everest2ropt from everest.simulator.everest_to_ert import everest_to_ert_config from everest.suite import _EverestWorkflow -from ropt.config.enopt import EnOptConfig - from tests.everest.test_config_validation import has_error from tests.everest.utils import relpath, tmpdir diff --git a/tests/everest/test_objective_type.py b/tests/everest/test_objective_type.py index f6797bf01b5..d98df4afd52 100644 --- a/tests/everest/test_objective_type.py +++ b/tests/everest/test_objective_type.py @@ -1,7 +1,7 @@ import pytest + from everest.config import EverestConfig from everest.suite import _EverestWorkflow - from tests.everest.utils import relpath, tmpdir CONFIG_PATH = relpath("..", "..", "examples", "math_func") diff --git a/tests/everest/test_optimization_config.py b/tests/everest/test_optimization_config.py index dfb672eaffe..d7cb30caf88 100644 --- a/tests/everest/test_optimization_config.py +++ b/tests/everest/test_optimization_config.py @@ -1,8 +1,8 @@ import os import pytest -from everest.config import EverestConfig +from everest.config import EverestConfig from tests.everest.utils import relpath, tmpdir diff --git a/tests/everest/test_output_constraints.py b/tests/everest/test_output_constraints.py index 7fe493d49cc..a1239468457 100644 --- a/tests/everest/test_output_constraints.py +++ b/tests/everest/test_output_constraints.py @@ -1,12 +1,13 @@ import os import pytest +from ropt.config.enopt import EnOptConfig +from ropt.enums import ConstraintType + from everest import ConfigKeys from everest.config import EverestConfig from everest.optimizer.everest2ropt import everest2ropt from everest.suite import _EverestWorkflow -from ropt.config.enopt import EnOptConfig -from ropt.enums import ConstraintType from .test_config_validation import has_error from .utils import relpath, tmpdir diff --git a/tests/everest/test_qt_dialogs_output.py b/tests/everest/test_qt_dialogs_output.py index 84260e8f08d..fa7703c7019 100644 --- a/tests/everest/test_qt_dialogs_output.py +++ b/tests/everest/test_qt_dialogs_output.py @@ -1,12 +1,13 @@ import pytest +from PyQt5.QtWidgets import QMessageBox +from qtpy.QtCore import Qt, QTimer + from everest.detached import ( context_stop_and_wait, wait_for_context, ) from ieverest import IEverest from ieverest.utils import APP_OUT_DIALOGS, app_output -from PyQt5.QtWidgets import QMessageBox -from qtpy.QtCore import Qt, QTimer @pytest.mark.ui_test diff --git a/tests/everest/test_queue_driver.py b/tests/everest/test_queue_driver.py index 8b4db664f46..940e883c886 100644 --- a/tests/everest/test_queue_driver.py +++ b/tests/everest/test_queue_driver.py @@ -1,6 +1,7 @@ from unittest.mock import Mock import pytest + from everest.config import EverestConfig from everest.queue_driver import queue_driver from everest.queue_driver.queue_driver import _extract_queue_system diff --git a/tests/everest/test_repo_configs.py b/tests/everest/test_repo_configs.py index e75794b4644..9d66f597467 100644 --- a/tests/everest/test_repo_configs.py +++ b/tests/everest/test_repo_configs.py @@ -1,8 +1,9 @@ import os +from ropt.exceptions import ConfigError as ROptConfigError + from everest.config_file_loader import yaml_file_to_substituted_config_dict from everest.optimizer.utils import get_ropt_plugin_manager -from ropt.exceptions import ConfigError as ROptConfigError def _get_all_files(folder): diff --git a/tests/everest/test_res_initialization.py b/tests/everest/test_res_initialization.py index 52d837c7e8b..a58e5af0e1f 100644 --- a/tests/everest/test_res_initialization.py +++ b/tests/everest/test_res_initialization.py @@ -2,8 +2,9 @@ import os from unittest.mock import patch -import everest import pytest + +import everest from ert.config import ErtConfig from everest import ConfigKeys from everest.config import EverestConfig @@ -13,7 +14,6 @@ from everest.config.workflow_config import WorkflowConfig from everest.simulator.everest_to_ert import everest_to_ert_config from everest.util.forward_models import collect_forward_models - from tests.everest.utils import ( everest_default_jobs, hide_opm, diff --git a/tests/everest/test_restart.py b/tests/everest/test_restart.py index 42cab95e2dd..6c3fe546831 100644 --- a/tests/everest/test_restart.py +++ b/tests/everest/test_restart.py @@ -1,7 +1,7 @@ import pytest + from everest.config import EverestConfig from everest.suite import _EverestWorkflow - from tests.everest.utils import relpath, tmpdir CONFIG_PATH = relpath("..", "..", "examples", "math_func") diff --git a/tests/everest/test_samplers.py b/tests/everest/test_samplers.py index a5d9758ebfa..3a22f569fee 100644 --- a/tests/everest/test_samplers.py +++ b/tests/everest/test_samplers.py @@ -1,8 +1,8 @@ import pytest + from everest.config import EverestConfig from everest.config.sampler_config import SamplerConfig from everest.suite import _EverestWorkflow - from tests.everest.utils import relpath, tmpdir CONFIG_PATH = relpath("..", "..", "examples", "math_func") diff --git a/tests/everest/test_seba_initialization.py b/tests/everest/test_seba_initialization.py index 3132f4c667e..ece00744127 100644 --- a/tests/everest/test_seba_initialization.py +++ b/tests/everest/test_seba_initialization.py @@ -2,13 +2,13 @@ import numpy import pytest -from everest.config import EverestConfig -from everest.config_file_loader import yaml_file_to_substituted_config_dict -from everest.optimizer.everest2ropt import everest2ropt from pydantic import ValidationError from ropt.config.enopt import EnOptConfig from ropt.enums import ConstraintType +from everest.config import EverestConfig +from everest.config_file_loader import yaml_file_to_substituted_config_dict +from everest.optimizer.everest2ropt import everest2ropt from tests.everest.utils import relpath, tmpdir _CONFIG_DIR = relpath("test_data/mocked_test_case") diff --git a/tests/everest/test_shell_scripts.py b/tests/everest/test_shell_scripts.py index 3e6ba5a60f3..251e44fac0a 100644 --- a/tests/everest/test_shell_scripts.py +++ b/tests/everest/test_shell_scripts.py @@ -1,6 +1,5 @@ from everest.config.everest_config import EverestConfig, get_system_installed_jobs from everest.jobs import shell_commands - from tests.everest.utils import relpath diff --git a/tests/everest/test_site_config_env.py b/tests/everest/test_site_config_env.py index d67fbf87117..94b1d2486e1 100644 --- a/tests/everest/test_site_config_env.py +++ b/tests/everest/test_site_config_env.py @@ -3,6 +3,7 @@ from unittest.mock import patch import pytest + from everest.plugins import hook_impl as everest_implementation from everest.plugins import hookimpl from everest.plugins.hook_manager import EverestPluginManager diff --git a/tests/everest/test_templating.py b/tests/everest/test_templating.py index 1ffa2eaea47..080160260ce 100644 --- a/tests/everest/test_templating.py +++ b/tests/everest/test_templating.py @@ -2,11 +2,11 @@ import os import subprocess -import everest import pytest -from everest.config import EverestConfig from ruamel.yaml import YAML +import everest +from everest.config import EverestConfig from tests.everest.utils import relpath, tmpdir TMPL_TEST_PATH = os.path.join("test_data", "templating") @@ -96,7 +96,7 @@ def test_render_multiple_input(): with open(wells_out, encoding="utf-8") as fin: output = fin.readlines() - assert ["0.2 vs 0.8"] == output + assert output == ["0.2 vs 0.8"] @tmpdir(relpath(TMPL_TEST_PATH)) diff --git a/tests/everest/test_ui_run.py b/tests/everest/test_ui_run.py index d20b8b26405..555718b4d70 100644 --- a/tests/everest/test_ui_run.py +++ b/tests/everest/test_ui_run.py @@ -1,7 +1,7 @@ import pytest -from ieverest import IEverest from qtpy.QtCore import Qt +from ieverest import IEverest from tests.everest.dialogs_mocker import mock_dialogs_all from tests.everest.utils import relpath, tmpdir diff --git a/tests/everest/test_util.py b/tests/everest/test_util.py index 845a97f6128..92acafda48f 100644 --- a/tests/everest/test_util.py +++ b/tests/everest/test_util.py @@ -3,6 +3,7 @@ from unittest.mock import patch import pytest + from everest import util from everest.bin.utils import report_on_previous_run from everest.config import EverestConfig @@ -10,7 +11,6 @@ from everest.config_keys import ConfigKeys from everest.detached import ServerStatus from everest.strings import SERVER_STATUS - from tests.everest.utils import ( capture_streams, hide_opm, @@ -31,7 +31,7 @@ @skipif_no_opm def test_loadwells(): wells = util.read_wellnames(SPE1_DATA) - assert ["PROD", "INJ"] == wells + assert wells == ["PROD", "INJ"] @skipif_no_opm diff --git a/tests/everest/test_well_tools.py b/tests/everest/test_well_tools.py index 843b214d55a..ae1be8d0872 100644 --- a/tests/everest/test_well_tools.py +++ b/tests/everest/test_well_tools.py @@ -2,10 +2,10 @@ import os import subprocess -import everest import pytest from ruamel.yaml import YAML +import everest from tests.everest.utils import tmpdir diff --git a/tests/everest/test_wells.py b/tests/everest/test_wells.py index a6bd7bbbf1e..b93245cf957 100644 --- a/tests/everest/test_wells.py +++ b/tests/everest/test_wells.py @@ -1,7 +1,7 @@ import pytest + from everest.config import EverestConfig from everest.config_file_loader import yaml_file_to_substituted_config_dict - from tests.everest.test_config_validation import has_error from tests.everest.utils import relpath diff --git a/tests/everest/test_workflows.py b/tests/everest/test_workflows.py index aae1cd85370..4869a1c4796 100644 --- a/tests/everest/test_workflows.py +++ b/tests/everest/test_workflows.py @@ -2,9 +2,9 @@ from typing import Callable, Optional import pytest + from everest.config import EverestConfig from everest.suite import _EverestWorkflow - from tests.everest.utils import relpath, skipif_no_everest_models, tmpdir CONFIG_DIR = relpath("test_data", "mocked_test_case") diff --git a/tests/everest/test_yaml_parser.py b/tests/everest/test_yaml_parser.py index 6f48d5b58fd..8c699a9c5c8 100644 --- a/tests/everest/test_yaml_parser.py +++ b/tests/everest/test_yaml_parser.py @@ -1,13 +1,13 @@ import os from pathlib import Path -import everest import pytest +from ruamel.yaml import YAML + +import everest from everest import ConfigKeys from everest.config import EverestConfig from everest.simulator.everest_to_ert import everest_to_ert_config -from ruamel.yaml import YAML - from tests.everest.utils import MockParser, relpath, skipif_no_everest_models, tmpdir snake_oil_folder = relpath("test_data", "snake_oil") diff --git a/tests/everest/unit/everest/bin/test_everload.py b/tests/everest/unit/everest/bin/test_everload.py index 497893d8fe4..ab33b759b65 100644 --- a/tests/everest/unit/everest/bin/test_everload.py +++ b/tests/everest/unit/everest/bin/test_everload.py @@ -4,12 +4,6 @@ import pandas as pd import pytest -from ert.config import ErtConfig -from everest import MetaDataColumnNames as MDCN -from everest import export -from everest.bin.everload_script import everload_entry -from everest.config import EverestConfig -from everest.strings import STORAGE_DIR from tests.everest.utils import ( capture_streams, create_cached_mocked_test_case, @@ -17,6 +11,13 @@ tmpdir, ) +from ert.config import ErtConfig +from everest import MetaDataColumnNames as MDCN +from everest import export +from everest.bin.everload_script import everload_entry +from everest.config import EverestConfig +from everest.strings import STORAGE_DIR + CONFIG_PATH = relpath("test_data", "mocked_test_case") CONFIG_FILE = "mocked_multi_batch.yml" diff --git a/tests/everest/utils/__init__.py b/tests/everest/utils/__init__.py index 61e309d232e..4ec878bb06c 100644 --- a/tests/everest/utils/__init__.py +++ b/tests/everest/utils/__init__.py @@ -11,6 +11,7 @@ import decorator import pytest + from everest.bin.main import start_everest from everest.config import EverestConfig from everest.detached import ServerStatus, everserver_status diff --git a/tests/everest/utils/test_pydantic_doc_generation.py b/tests/everest/utils/test_pydantic_doc_generation.py index c19e4adcc75..f3f75c5f0f7 100644 --- a/tests/everest/utils/test_pydantic_doc_generation.py +++ b/tests/everest/utils/test_pydantic_doc_generation.py @@ -1,8 +1,8 @@ import sys import pytest -from everest.docs.generate_docs_from_config_spec import generate_docs_pydantic_to_rst +from everest.docs.generate_docs_from_config_spec import generate_docs_pydantic_to_rst from tests.everest.utils import relpath