You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2012/03/22 12:17:56 UTC

svn commit: r1303734 - /subversion/trunk/subversion/tests/cmdline/svntest/main.py

Author: julianfoad
Date: Thu Mar 22 11:17:56 2012
New Revision: 1303734

URL: http://svn.apache.org/viewvc?rev=1303734&view=rev
Log:
Make it easier to turn off timing information in the test suite.

* subversion/tests/cmdline/svntest/main.py
  (log_with_timestamps): New variable.
  (formatter): Use it to enable or disable the timestamp prefix on log lines.
  (run_command_stdin): Use it to enable or disable the '<TIME = ...>' lines.

Modified:
    subversion/trunk/subversion/tests/cmdline/svntest/main.py

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1303734&r1=1303733&r2=1303734&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Thu Mar 22 11:17:56 2012
@@ -78,11 +78,18 @@ SVN_VER_MINOR = 8
 
 default_num_threads = 5
 
+# This enables both a time stamp prefix on all log lines and a
+# '<TIME = 0.042552>' line after running every external command.
+log_with_timestamps = True
+
 # Set up logging
 logger = logging.getLogger()
 handler = logging.StreamHandler(sys.stdout)
-formatter = logging.Formatter('%(asctime)s [%(levelname)s] %(message)s',
-                              '%Y-%m-%d %H:%M:%S')
+if log_with_timestamps:
+  formatter = logging.Formatter('%(asctime)s [%(levelname)s] %(message)s',
+                                '%Y-%m-%d %H:%M:%S')
+else:
+  formatter = logging.Formatter('[%(levelname)s] %(message)s')
 handler.setFormatter(formatter)
 logger.addHandler(handler)
 
@@ -504,8 +511,9 @@ def run_command_stdin(command, error_exp
                                                         stdin_lines,
                                                         *varargs)
 
-  stop = time.time()
-  logger.info('<TIME = %.6f>' % (stop - start))
+  if log_with_timestamps:
+    stop = time.time()
+    logger.info('<TIME = %.6f>' % (stop - start))
   for x in stdout_lines:
     logger.info(x[:-1])
   for x in stderr_lines: