From 99fc7205a7edce9cfa58ef3beb09a18914e6d716 Mon Sep 17 00:00:00 2001 From: iamkenos Date: Thu, 17 Oct 2024 11:55:18 +1100 Subject: [PATCH] fix: replace scenario_info.id_hash with uuid --- behavex/outputs/report_json.py | 5 ++--- behavex/utils.py | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/behavex/outputs/report_json.py b/behavex/outputs/report_json.py index f8673d0..b50c974 100644 --- a/behavex/outputs/report_json.py +++ b/behavex/outputs/report_json.py @@ -27,7 +27,7 @@ from behavex.outputs.report_utils import (get_environment_details, get_error_message, match_for_execution, text) -from behavex.utils import (generate_hash, get_scenario_tags, +from behavex.utils import (generate_hash, generate_uuid, get_scenario_tags, try_operate_descriptor) @@ -181,8 +181,7 @@ def _processing_scenarios(scenarios, scenario_list, id_feature): scenario_info['error_lines'] = error_lines scenario_info['error_step'] = error_step scenario_info['error_background'] = error_background - scenario_info['id_hash'] = generate_hash("{}:{}".format(scenario.filename, - scenario.line)) + scenario_info['id_hash'] = generate_uuid() if scenario.feature.name in global_vars.retried_scenarios: if ( scenario.name diff --git a/behavex/utils.py b/behavex/utils.py index 6c8d4dc..b0c21c1 100644 --- a/behavex/utils.py +++ b/behavex/utils.py @@ -18,6 +18,7 @@ import shutil import sys import time +import uuid from functools import reduce from tempfile import gettempdir @@ -583,3 +584,6 @@ def generate_hash(word): hash_int = int.from_bytes(truncated_hash, byteorder='big') # Ensure the result fits in 48 bits (optional, for consistency) return hash_int & 0xFFFFFFFFFFFF + +def generate_uuid(): + return uuid.uuid4().hex