From 07b512e3a3a418c62b99cc8335a06b559b6122d3 Mon Sep 17 00:00:00 2001 From: "christian.lutnik" Date: Tue, 28 Jan 2025 11:04:22 +0100 Subject: [PATCH] fixup! Add evaluation details to finally hook stage #403 Signed-off-by: christian.lutnik --- openfeature/client.py | 9 +++++++++ tests/features/steps/hooks_steps.py | 1 + 2 files changed, 10 insertions(+) diff --git a/openfeature/client.py b/openfeature/client.py index 9430bddd..fd05e8a0 100644 --- a/openfeature/client.py +++ b/openfeature/client.py @@ -393,6 +393,15 @@ def evaluate_flag_details( # noqa: PLR0915 return flag_evaluation finally: + if flag_evaluation is None: # should never happen, but keeps the linter happy + flag_evaluation = FlagEvaluationDetails( + flag_key=flag_key, + value=default_value, + reason=Reason.ERROR, + error_code=ErrorCode.GENERAL, + error_message="Unknown error", + ) + after_all_hooks( flag_type, hook_context, diff --git a/tests/features/steps/hooks_steps.py b/tests/features/steps/hooks_steps.py index e527a5a2..bc7e156b 100644 --- a/tests/features/steps/hooks_steps.py +++ b/tests/features/steps/hooks_steps.py @@ -55,6 +55,7 @@ def convert_value_from_flag_type(value, flag_type): return float(value) return value + @then('"{hook_names}" hooks should have evaluation details') def step_impl_should_have_eval_details(context, hook_names): for hook_name in hook_names.split(", "):