diff --git a/src/_ert/events.py b/src/_ert/events.py index c3704ef6c83..0f810286f9e 100644 --- a/src/_ert/events.py +++ b/src/_ert/events.py @@ -7,7 +7,7 @@ else: from typing import Annotated -from pydantic import BaseModel, Field, TypeAdapter +from pydantic import BaseModel, ConfigDict, Field, TypeAdapter class Id: @@ -65,6 +65,7 @@ class Id: class BaseEvent(BaseModel): + model_config = ConfigDict(strict=True, extra="forbid") time: datetime = Field(default_factory=datetime.now) @@ -159,12 +160,12 @@ class EnsembleCancelled(EnsembleBaseEvent): event_type: Id.ENSEMBLE_CANCELLED_TYPE = Id.ENSEMBLE_CANCELLED -class EESnapshot(BaseEvent): +class EESnapshot(EnsembleBaseEvent): event_type: Id.EE_SNAPSHOT_TYPE = Id.EE_SNAPSHOT snapshot: Any -class EESnapshotUpdate(BaseEvent): +class EESnapshotUpdate(EnsembleBaseEvent): event_type: Id.EE_SNAPSHOT_UPDATE_TYPE = Id.EE_SNAPSHOT_UPDATE snapshot: Any @@ -230,15 +231,15 @@ class EEUserDone(BaseEvent): def dispatch_event_from_json(raw_msg: Union[str, bytes]) -> DispatchEvent: - return DispatchEventAdapter.validate_json(raw_msg, strict=True) + return DispatchEventAdapter.validate_json(raw_msg) def event_from_json(raw_msg: Union[str, bytes]) -> Event: - return EventAdapter.validate_json(raw_msg, strict=True) + return EventAdapter.validate_json(raw_msg) def event_from_dict(dict_msg: Dict[str, Any]) -> Event: - return EventAdapter.validate_python(dict_msg, strict=True) + return EventAdapter.validate_python(dict_msg) def event_to_json(event: Event) -> str: diff --git a/tests/performance_tests/test_snapshot.py b/tests/performance_tests/test_snapshot.py index c1f11a96d33..1b12a57ed69 100644 --- a/tests/performance_tests/test_snapshot.py +++ b/tests/performance_tests/test_snapshot.py @@ -103,8 +103,8 @@ def simulate_forward_model_event_handling( ensemble=ens_id, real=str(real), fm_step=str(fm_idx), - stderr="foo", - stdout="bar", + std_err="foo", + std_out="bar", ) ) for current_memory_usage in range(memory_reports):