changeset 21535:ab7e224bc089

run-tests: avoid duplicate code in vlog()
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 09 May 2014 15:55:58 -0700
parents 3ece55d16044
children 92a6b16c9186
files tests/run-tests.py
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Fri Apr 25 15:34:28 2014 -0700
+++ b/tests/run-tests.py	Fri May 09 15:55:58 2014 -0700
@@ -295,17 +295,17 @@
 
 verbose = False
 def vlog(*msg):
-    if verbose is not False:
-        iolock.acquire()
-        if verbose:
-            print verbose,
-        for m in msg:
-            print m,
-        print
-        sys.stdout.flush()
-        iolock.release()
+    """Log only when in verbose mode."""
+    if verbose is False:
+        return
+
+    return log(*msg)
 
 def log(*msg):
+    """Log something to stdout.
+
+    Arguments are strings to print.
+    """
     iolock.acquire()
     if verbose:
         print verbose,