From 8c7e64472335986ab582b198ab4652a4325f4b5c Mon Sep 17 00:00:00 2001 From: Nick Schrock Date: Wed, 20 Sep 2023 12:28:47 -0400 Subject: [PATCH] Deprecate ExpectationResult (#16645) ## Summary & Motivation With real asset checks coming we can deprecate this old, useless class. ## How I Tested These Changes BK --- .../dagster/dagster/_core/definitions/events.py | 6 +++++- .../dagster_tests/execution_tests/test_expectations.py | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/python_modules/dagster/dagster/_core/definitions/events.py b/python_modules/dagster/dagster/_core/definitions/events.py index 04333178b4c3e..7c21cc20025ab 100644 --- a/python_modules/dagster/dagster/_core/definitions/events.py +++ b/python_modules/dagster/dagster/_core/definitions/events.py @@ -18,7 +18,7 @@ import dagster._check as check import dagster._seven as seven -from dagster._annotations import PublicAttr, experimental_param, public +from dagster._annotations import PublicAttr, deprecated, experimental_param, public from dagster._core.definitions.data_version import DataVersion from dagster._core.storage.tags import MULTIDIMENSIONAL_PARTITION_PREFIX, SYSTEM_TAG_PREFIX from dagster._serdes import whitelist_for_serdes @@ -618,6 +618,10 @@ def file( ) +@deprecated( + breaking_version="1.7", + additional_warn_text="Please use AssetCheckResult and @asset_check instead.", +) @whitelist_for_serdes( storage_field_names={"metadata": "metadata_entries"}, field_serializers={"metadata": MetadataFieldSerializer}, diff --git a/python_modules/dagster/dagster_tests/execution_tests/test_expectations.py b/python_modules/dagster/dagster_tests/execution_tests/test_expectations.py index 14c48100c6ae6..b592d4dc76bf4 100644 --- a/python_modules/dagster/dagster_tests/execution_tests/test_expectations.py +++ b/python_modules/dagster/dagster_tests/execution_tests/test_expectations.py @@ -8,6 +8,7 @@ GraphDefinition, op, ) +from dagster._annotations import get_deprecated_info, is_deprecated from dagster._core.events import DagsterEvent from dagster._core.execution.execution_result import ExecutionResult @@ -85,3 +86,11 @@ def return_expectation_failure(_context): ), ): job_def.execute_in_process() + + +def test_expectation_result_deprecated() -> None: + assert is_deprecated(ExpectationResult) + assert ( + get_deprecated_info(ExpectationResult).additional_warn_text + == "Please use AssetCheckResult and @asset_check instead." + )