comparison roundup/configuration.py @ 8451:401c6f0be6c5

bug: fix json logging config file syntax exception/fix test for windows If the json logging config file has mimatched {} or [], it raises an IndexError. Handle that case and test it. Also handle embedded filenames in tests when testsare run on windows:(/ vs \ directory sep).
author John Rouillard <rouilj@ieee.org>
date Wed, 17 Sep 2025 19:58:08 -0400
parents d06be9346c68
children e91ff70e4563
comparison
equal deleted inserted replaced
8450:df9fc9080e5a 8451:401c6f0be6c5
2602 config_dict = json.loads("".join(config_list)) 2602 config_dict = json.loads("".join(config_list))
2603 except json.decoder.JSONDecodeError as e: 2603 except json.decoder.JSONDecodeError as e:
2604 error_at_doc_line = e.lineno 2604 error_at_doc_line = e.lineno
2605 # subtract 1 - zero index on config_list 2605 # subtract 1 - zero index on config_list
2606 # remove '\n' for display 2606 # remove '\n' for display
2607 line = config_list[error_at_doc_line - 1][:-1] 2607 try:
2608 line = config_list[error_at_doc_line - 1][:-1]
2609 except IndexError:
2610 line = _("Error found at end of file. Maybe missing a "
2611 "block closing '}'.")
2608 2612
2609 hint = "" 2613 hint = ""
2610 if line.find('//') != -1: 2614 if line.find('//') != -1:
2611 hint = "\nMaybe bad inline comment, 3 spaces needed before //." 2615 hint = "\nMaybe bad inline comment, 3 spaces needed before //."
2612 2616

Roundup Issue Tracker: http://roundup-tracker.org/