diff test/test_config.py @ 8433:de1dac9abcb6

feat: change comment in dictConfig json file to // from # Emacs json mode at least will properly indent when using // as a comment character and not #.
author John Rouillard <rouilj@ieee.org>
date Tue, 26 Aug 2025 22:24:00 -0400
parents 3210729950b1
children 66284037142e
line wrap: on
line diff
--- a/test/test_config.py	Mon Aug 25 20:44:42 2025 -0400
+++ b/test/test_config.py	Tue Aug 26 22:24:00 2025 -0400
@@ -1117,35 +1117,35 @@
         # good base test case
         config1 = dedent("""
            {
-              "version": 1,   # only supported version
-              "disable_existing_loggers": false,      # keep the wsgi loggers
+              "version": 1,   // only supported version
+              "disable_existing_loggers": false,      // keep the wsgi loggers
 
               "formatters": {
-                # standard Roundup formatter including context id.
+                // standard Roundup formatter including context id.
                   "standard": {
                     "format": "%(asctime)s %(levelname)s %(name)s:%(module)s %(msg)s"
                 },
-                # used for waitress wsgi server to produce httpd style logs
+                // used for waitress wsgi server to produce httpd style logs
                 "http": {
                   "format": "%(message)s"
                 }
               },
               "handlers": {
-                # create an access.log style http log file
+                // create an access.log style http log file
                 "access": {
                   "level": "INFO",
                   "formatter": "http",
                   "class": "logging.FileHandler",
                   "filename": "_test_instance/access.log"
                 },
-                # logging for roundup.* loggers
+                // logging for roundup.* loggers
                 "roundup": {
                   "level": "DEBUG",
                   "formatter": "standard",
                   "class": "logging.FileHandler",
                   "filename": "_test_instance/roundup.log"
                 },
-                # print to stdout - fall through for other logging
+                // print to stdout - fall through for other logging
                 "default": {
                   "level": "DEBUG",
                   "formatter": "standard",
@@ -1156,35 +1156,35 @@
               "loggers": {
                 "": {
                   "handlers": [
-                    "default"     # used by wsgi/usgi
+                    "default"     // used by wsgi/usgi
                   ],
                   "level": "DEBUG",
                   "propagate": false
                 },
-                # used by roundup.* loggers
+                // used by roundup.* loggers
                 "roundup": {
                   "handlers": [
                     "roundup"
                   ],
                   "level": "DEBUG",
-                  "propagate": false   # note pytest testing with caplog requires
-                                       # this to be true
+                  "propagate": false   // note pytest testing with caplog requires
+                                       // this to be true
                 },
                 "roundup.hyperdb": {
                   "handlers": [
                     "roundup"
                   ],
-                  "level": "INFO",    # can be a little noisy INFO for production
+                  "level": "INFO",    // can be a little noisy INFO for production
                   "propagate": false
                 },
-               "roundup.wsgi": {    # using the waitress framework
+               "roundup.wsgi": {    // using the waitress framework
                   "handlers": [
                     "roundup"
                   ],
                   "level": "DEBUG",
                   "propagate": false
                 },
-               "roundup.wsgi.translogger": {   # httpd style logging
+               "roundup.wsgi.translogger": {   // httpd style logging
                   "handlers": [
                     "access"
                   ],
@@ -1215,7 +1215,7 @@
         self.assertEqual(config['version'], 1)
 
         # broken inline comment misformatted
-        test_config = config1.replace(": 1,   #", ": 1, #")
+        test_config = config1.replace(": 1,   //", ": 1, //")
         with open(log_config_filename, "w") as log_config_file:
             log_config_file.write(test_config)
 
@@ -1226,9 +1226,9 @@
             cm.exception.args[0],
             ('Error parsing json logging dict '
              '(%s) near \n\n     '
-             '"version": 1, # only supported version\n\nExpecting '
+             '"version": 1, // only supported version\n\nExpecting '
              'property name enclosed in double quotes: line 3 column 18.\n'
-             'Maybe bad inline comment, 3 spaces needed before #.' %
+             'Maybe bad inline comment, 3 spaces needed before //.' %
              log_config_filename)
         )
 
@@ -1318,8 +1318,8 @@
 
         # broken invalid level MANGO
         test_config = config1.replace(
-            ': "INFO",    # can',
-            ': "MANGO",    # can')
+            ': "INFO",    // can',
+            ': "MANGO",    // can')
         with open(log_config_filename, "w") as log_config_file:
             log_config_file.write(test_config)
 

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