Script to run tests.
[python_utils.git] / bootstrap.py
index d1233e9344f54be3f84555a9b392faf1d5fe2054..da421b6f0a35dd2c0c269728f71427750e7e6708 100644 (file)
@@ -7,9 +7,10 @@ import sys
 import time
 import traceback
 
+# This module is commonly used by others in here and should avoid
+# taking any unnecessary dependencies back on them.
 import argparse_utils
 import config
-import logging_utils
 
 
 logger = logging.getLogger(__name__)
@@ -41,13 +42,16 @@ def handle_uncaught_exception(
 
 
 def initialize(funct):
+    import logging_utils
+
     """Remember to initialize config and logging before running main."""
     @functools.wraps(funct)
     def initialize_wrapper(*args, **kwargs):
         sys.excepthook = handle_uncaught_exception
         config.parse()
         logging_utils.initialize_logging(logging.getLogger())
-        logger.debug(f"About to invoke {funct}...")
+        config.late_logging()
+        logger.debug(f'Starting {funct.__name__}')
         start = time.perf_counter()
         ret = funct(*args, **kwargs)
         end = time.perf_counter()
@@ -59,6 +63,9 @@ def initialize(funct):
                      f'child system: {cstime}s\n'
                      f'elapsed: {elapsed_time}s\n'
                      f'walltime: {end - start}s\n')
-        logger.info(f'Exit {ret}')
+        if ret != 0:
+            logger.info(f'Exit {ret}')
+        else:
+            logger.debug(f'Exit {ret}')
         sys.exit(ret)
     return initialize_wrapper