comparison test/test_config.py @ 8457:f7fadbac5856

take2: merge multiple fix: python < 3.12 returns ParsingError not RuntimeError; print exception
author John Rouillard <rouilj@ieee.org>
date Mon, 22 Sep 2025 14:12:46 -0400
parents 9f7e863fd1cd 6d6f689d3701
children 16e8bacb8f90
comparison
equal deleted inserted replaced
8456:9f7e863fd1cd 8457:f7fadbac5856
1722 output = cm.exception.args[0].replace(r'\\','\\') 1722 output = cm.exception.args[0].replace(r'\\','\\')
1723 1723
1724 if sys.version_info >= (3, 12, 0): 1724 if sys.version_info >= (3, 12, 0):
1725 expected = ( 1725 expected = (
1726 "Error loading logging config from %(filename)s.\n\n" 1726 "Error loading logging config from %(filename)s.\n\n"
1727 " %(filename)s is invalid: Source contains parsing errors: " 1727 " RuntimeError: %(filename)s is invalid: Source contains parsing errors: "
1728 "'%(filename)s'\n\t[line 9]: '=foo\\n'\n\n" 1728 "'%(filename)s'\n\t[line 9]: '=foo\\n'\n\n"
1729 "Source contains parsing errors: '%(filename)s'\n" 1729 "Source contains parsing errors: '%(filename)s'\n"
1730 "\t[line 9]: '=foo\\n' Unspecified run-time error.\n" % 1730 "\t[line 9]: '=foo\\n' Unspecified run-time error.\n" %
1731 {"filename": log_config_filename}) 1731 {"filename": log_config_filename})
1732 1732
1738 "'%(filename)s'\n" 1738 "'%(filename)s'\n"
1739 "\t[line 9]: '=foo\\n'\n\n" 1739 "\t[line 9]: '=foo\\n'\n\n"
1740 "Raised when a configuration file does not follow legal " 1740 "Raised when a configuration file does not follow legal "
1741 "syntax.\n" % {"filename": log_config_filename}) 1741 "syntax.\n" % {"filename": log_config_filename})
1742 1742
1743 print(output)
1744
1745 self.assertEqual(output, expected) 1743 self.assertEqual(output, expected)
1746 self.reset_logging() 1744 self.reset_logging()
1747 1745
1748 # handler = basic to handler = basi 1746 # handler = basic to handler = basi
1749 test_config = config1.replace("handlers=basic\n", "handlers=basi\n", 1) 1747 test_config = config1.replace("handlers=basic\n", "handlers=basi\n", 1)

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