From 2c5ae0b9bcff21be4ddc056b5546f83cce8dd2e9 Mon Sep 17 00:00:00 2001 From: Arkadiusz Szczepkowicz Date: Fri, 12 Jul 2024 13:29:34 +0200 Subject: [PATCH] #2291: Update printing in the python compare script --- scripts/compare_lb_data_file.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/compare_lb_data_file.py b/scripts/compare_lb_data_file.py index ce16b0d656..f17b491576 100644 --- a/scripts/compare_lb_data_file.py +++ b/scripts/compare_lb_data_file.py @@ -11,17 +11,17 @@ def compare(file_to_validate, reference_file): to_validate = json.load(val_file) reference = json.load(ref_file) diff = DeepDiff(to_validate, reference, report_repetition=True, math_epsilon=0.1) - is_valid = not len(diff.affected_paths) - if not is_valid: - sys.stderr.write("Comparing '" + file_to_validate + "' with reference file '" + reference_file + "'... Failed!\n") + message = f"Comparing '{file_to_validate}' with reference file '{reference_file}'..." + if diff: + sys.stderr.write(f"{message} Failed!\n") sys.stderr.write("Detected differences:\n") json.dump(str(diff), sys.stderr, indent=4) sys.stderr.write("\n") sys.stderr.flush() sys.exit(1) else: - print("Comparing '" + file_to_validate + "' with reference file '" + reference_file + "'... Status OK.") + print(f"{message} Status OK.") def main(): parser = argparse.ArgumentParser()