Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for installation of everest_models jobs #9116

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions tests/everest/test_fm_plugins.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import logging
from importlib import resources
from itertools import chain
from typing import Callable, Iterator, Sequence, Type

import pluggy
import pytest
from pydantic import BaseModel

from ert import ForwardModelStepPlugin
from everest.config import EverestConfig
from everest.plugins import hook_impl, hook_specs, hookimpl
from everest.simulator.everest_to_ert import everest_to_ert_config
from everest.strings import EVEREST
from everest.util.forward_models import collect_forward_models

SNAKE_CONFIG_PATH = "test_data/snake_oil/everest/model/snake_oil.yml"


class MockPluginManager(pluggy.PluginManager):
"""A testing plugin manager"""
Expand Down Expand Up @@ -43,11 +49,14 @@ def test_jobs():

def test_everest_models_jobs(plugin_manager):
pytest.importorskip("everest_models")
pm = plugin_manager()
assert any(
hook.plugin_name.startswith(EVEREST)
for hook in pm.hook.get_forward_models.get_hookimpls()
)
ert_config = everest_to_ert_config(EverestConfig.load_file(SNAKE_CONFIG_PATH))
jobs = list(resources.contents("everest_models.jobs"))
assert bool(jobs)
for job in jobs:
if job.startswith("fm_"):
job_class = ert_config.installed_forward_model_steps.get(job.lstrip("fm_"))
assert job_class is not None
assert isinstance(job_class, ForwardModelStepPlugin)


def test_multiple_plugins(plugin_manager):
Expand Down