You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2012/03/13 02:58:59 UTC

svn commit: r1299950 - /subversion/trunk/subversion/tests/cmdline/svntest/wc.py

Author: hwright
Date: Tue Mar 13 01:58:59 2012
New Revision: 1299950

URL: http://svn.apache.org/viewvc?rev=1299950&view=rev
Log:
Convert svntest.wc to logging, rather than print() (or pprint).

* subversion/tests/cmdline/svntest/wc.py:
  Use the logging module to output error conditions.

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

Modified: subversion/trunk/subversion/tests/cmdline/svntest/wc.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/wc.py?rev=1299950&r1=1299949&r2=1299950&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/wc.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/wc.py Tue Mar 13 01:58:59 2012
@@ -27,9 +27,13 @@ import os
 import sys
 import re
 import urllib
+import logging
+import pprint
 
 import svntest
 
+logger = logging.getLogger()
+
 
 #
 # 'status -v' output looks like this:
@@ -362,9 +366,8 @@ class State:
     if 0:
       check = tree.as_state()
       if self != check:
-        import pprint
-        pprint.pprint(self.desc)
-        pprint.pprint(check.desc)
+        logger.warn(pprint.pformat(self.desc))
+        logger.warn(pprint.pformat(check.desc))
         # STATE -> TREE -> STATE is lossy.
         # In many cases, TREE -> STATE -> TREE is not.
         # Even though our conversion from a TREE has lost some information, we
@@ -894,21 +897,25 @@ def display_nodes(label, path, expected,
   'Display two nodes, expected and actual.'
   expected = item_to_node(path, expected)
   actual = item_to_node(path, actual)
-  print("=============================================================")
-  print("Expected '%s' and actual '%s' in %s tree are different!"
-        % (expected.name, actual.name, label))
-  print("=============================================================")
-  print("EXPECTED NODE TO BE:")
-  print("=============================================================")
-  expected.pprint()
-  print("=============================================================")
-  print("ACTUAL NODE FOUND:")
-  print("=============================================================")
-  actual.pprint()
+
+  output = [
+        "=============================================================\n",
+        "Expected '%s' and actual '%s' in %s tree are different!\n"
+                % (expected.name, actual.name, label),
+        "=============================================================\n",
+        "EXPECTED NODE TO BE:\n",
+        "=============================================================\n",
+        pprint.pformat(expected), '\n',
+        "=============================================================\n",
+        "ACTUAL NODE FOUND:\n",
+        "=============================================================\n",
+        pprint.pformat(actual), '\n',
+    ]
+  logger.warn(''.join(output))
 
 ### yanked from tree.py
 def default_singleton_handler(description, path, item):
   node = item_to_node(path, item)
-  print("Couldn't find node '%s' in %s tree" % (node.name, description))
-  node.pprint()
+  logger.warn("Couldn't find node '%s' in %s tree" % (node.name, description))
+  logger.warn(pprint.pformat(node))
   raise svntest.tree.SVNTreeUnequal