[Zope-Checkins] CVS: Zope - test.py:1.2.2.5

Stefan H. Holek stefan at epy.co.at
Tue Jul 27 13:34:59 EDT 2004


Update of /cvs-repository/Zope
In directory cvs.zope.org:/tmp/cvs-serv25631

Modified Files:
      Tag: Zope-2_7-branch
	test.py 
Log Message:
Sync test.py with the trunk (re --config-file switch).


=== Zope/test.py 1.2.2.4 => 1.2.2.5 ===
--- Zope/test.py:1.2.2.4	Tue Jul 27 12:17:47 2004
+++ Zope/test.py	Tue Jul 27 13:34:58 2004
@@ -47,7 +47,7 @@
     line.)
 
 -c  
-    use pychecker
+    Use pychecker
 
 --config-file filename
     Configure Zope by loading the specified configuration file (zope.conf).
@@ -618,6 +618,8 @@
     global pathinit
     global config_file
 
+    configure_logging()
+
     # Initialize the path and cwd
     pathinit = PathInit(build, libdir)
 
@@ -635,22 +637,6 @@
     if import_testing:
         import Testing
 
-    # Get the log.ini file from the current directory instead of possibly
-    # buried in the build directory.  XXX This isn't perfect because if
-    # log.ini specifies a log file, it'll be relative to the build directory.
-    # Hmm...
-    logini = os.path.abspath('log.ini')
-
-    # Initialize the logging module.
-    import logging.config
-    logging.basicConfig()
-    level = os.getenv("LOGGING")
-    if level:
-        level = int(level)
-    else:
-        level = logging.CRITICAL
-    logging.root.setLevel(level)
-
     files = find_tests(module_filter)
     files.sort()
 
@@ -673,6 +659,26 @@
                 track.update()
     else:
         runner(files, test_filter, debug)
+
+
+def configure_logging():
+    """Initialize the logging module."""
+    import logging.config
+
+    # Get the log.ini file from the current directory instead of possibly                                      
+    # buried in the build directory.  XXX This isn't perfect because if
+    # log.ini specifies a log file, it'll be relative to the build directory.
+    # Hmm...
+    logini = os.path.abspath("log.ini")
+
+    if os.path.exists(logini):
+        logging.config.fileConfig(logini)
+    else:
+        logging.basicConfig()
+
+    if os.environ.has_key("LOGGING"):
+        level = int(os.environ["LOGGING"])
+        logging.getLogger().setLevel(level)
 
 
 def process_args(argv=None):



More information about the Zope-Checkins mailing list