subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1310488 - in /subversion/trunk/subversion/tests/cmdline: basic_tests.py diff_tests.py info_tests.py
Date Fri, 06 Apr 2012 17:15:56 GMT
Author: hwright
Date: Fri Apr  6 17:15:55 2012
New Revision: 1310488

URL: http://svn.apache.org/viewvc?rev=1310488&view=rev
Log:
Remove more manual print statements in favor of logging in the test suite.

* subversion/tests/cmdline/basic_tests.py,
  subversion/tests/cmdline/info_tests.py,
  subversion/tests/cmdline/diff_tests.py:
  s/print/logger.warn()/

Modified:
    subversion/trunk/subversion/tests/cmdline/basic_tests.py
    subversion/trunk/subversion/tests/cmdline/diff_tests.py
    subversion/trunk/subversion/tests/cmdline/info_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/basic_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/basic_tests.py?rev=1310488&r1=1310487&r2=1310488&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/basic_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/basic_tests.py Fri Apr  6 17:15:55 2012
@@ -25,7 +25,9 @@
 ######################################################################
 
 # General modules
-import shutil, stat, re, os
+import shutil, stat, re, os, logging
+
+logger = logging.getLogger()
 
 # Our testing module
 import svntest
@@ -659,8 +661,8 @@ def basic_conflict(sbox):
     # probably reveal the cause for the failure, if they were
     # uncommented:
     #
-    # print("Not all extra reject files have been accounted for:")
-    # print(extra_files)
+    # logger.warn("Not all extra reject files have been accounted for:")
+    # logger.warn(extra_files)
     ### we should raise a less generic error here. which?
     raise svntest.Failure
 
@@ -780,17 +782,17 @@ def basic_revert(sbox):
   fp = open(beta_path, 'r')
   lines = fp.readlines()
   if not ((len (lines) == 1) and (lines[0] == "This is the file 'beta'.\n")):
-    print("Revert failed to restore original text.")
+    logger.warn("Revert failed to restore original text.")
     raise svntest.Failure
   fp = open(iota_path, 'r')
   lines = fp.readlines()
   if not ((len (lines) == 1) and (lines[0] == "This is the file 'iota'.\n")):
-    print("Revert failed to restore original text.")
+    logger.warn("Revert failed to restore original text.")
     raise svntest.Failure
   fp = open(rho_path, 'r')
   lines = fp.readlines()
   if not ((len (lines) == 1) and (lines[0] == "This is the file 'rho'.\n")):
-    print("Revert failed to restore original text.")
+    logger.warn("Revert failed to restore original text.")
     raise svntest.Failure
   fp = open(zeta_path, 'r')
   lines = fp.readlines()
@@ -989,7 +991,7 @@ def verify_file_deleted(message, path):
   except IOError:
     return
   if message is not None:
-    print(message)
+    logger.warn(message)
   ###TODO We should raise a less generic error here. which?
   raise svntest.Failure
 
@@ -1168,11 +1170,11 @@ def basic_delete(sbox):
 
   # check unversioned and added dirs has been removed
   if verify_dir_deleted(Q_path):
-    print("Failed to remove unversioned dir")
+    logger.warn("Failed to remove unversioned dir")
     ### we should raise a less generic error here. which?
     raise svntest.Failure
   if verify_dir_deleted(X_path):
-    print("Failed to remove added dir")
+    logger.warn("Failed to remove added dir")
     ### we should raise a less generic error here. which?
     raise svntest.Failure
 
@@ -1673,8 +1675,8 @@ def basic_info(sbox):
       if line.startswith('Path: '):
         paths.append(line[6:].rstrip())
     if paths != expected_paths:
-      print("Reported paths: %s" % paths)
-      print("Expected paths: %s" % expected_paths)
+      logger.warn("Reported paths: %s" % paths)
+      logger.warn("Expected paths: %s" % expected_paths)
       raise svntest.Failure
 
   sbox.build(read_only = True)
@@ -1697,7 +1699,7 @@ def repos_root(sbox):
       if line == "Repository Root: " + sbox.repo_url + "\n":
         break
     else:
-      print("Bad or missing repository root")
+      logger.warn("Bad or missing repository root")
       raise svntest.Failure
 
   sbox.build(read_only = True)
@@ -1920,7 +1922,7 @@ def delete_keep_local_twice(sbox):
   svntest.actions.run_and_verify_svn(None, None, [], 'rm', '--keep-local', dir)
 
   if not os.path.isdir(dir):
-    print('Directory was really deleted')
+    logger.warn('Directory was really deleted')
     raise svntest.Failure
 
 def windows_paths_in_repos(sbox):
@@ -2194,8 +2196,8 @@ def automatic_conflict_resolution(sbox):
     # probably reveal the cause for the failure, if they were
     # uncommented:
     #
-    # print("Not all extra reject files have been accounted for:")
-    # print(extra_files)
+    # logger.warn("Not all extra reject files have been accounted for:")
+    # logger.warn(extra_files)
     ### we should raise a less generic error here. which?
     raise svntest.Failure
 

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=1310488&r1=1310487&r2=1310488&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Fri Apr  6 17:15:55 2012
@@ -26,7 +26,9 @@
 ######################################################################
 
 # General modules
-import sys, re, os, time, shutil
+import sys, re, os, time, shutil, logging
+
+logger = logging.getLogger()
 
 # Our testing module
 import svntest
@@ -268,8 +270,8 @@ def verify_excluded_output(diff_output, 
   "verify given line does not exist in diff output as diff line"
   for line in diff_output:
     if re.match("^(\\+|-)%s" % re.escape(excluded), line):
-      print('Sought: %s' % excluded)
-      print('Found:  %s' % line)
+      logger.warn('Sought: %s' % excluded)
+      logger.warn('Found:  %s' % line)
       raise svntest.Failure
 
 def extract_diff_path(line):
@@ -1570,7 +1572,7 @@ def check_for_omitted_prefix_in_path_com
   good_dest = ".../prefix_other/mytag"
 
   if ((src != good_src) or (dest != good_dest)):
-    print("src is '%s' instead of '%s' and dest is '%s' instead of '%s'" %
+    logger.warn("src is '%s' instead of '%s' and dest is '%s' instead of '%s'" %
           (src, good_src, dest, good_dest))
     raise svntest.Failure
 

Modified: subversion/trunk/subversion/tests/cmdline/info_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/info_tests.py?rev=1310488&r1=1310487&r2=1310488&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/info_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/info_tests.py Fri Apr  6 17:15:55 2012
@@ -27,7 +27,9 @@
 # See basic-tests.py for more svn info tests.
 
 # General modules
-import shutil, stat, re, os
+import shutil, stat, re, os, logging
+
+logger = logging.getLogger()
 
 # Our testing module
 import svntest
@@ -74,9 +76,9 @@ def verify_xml_elements(lines, exprs):
     str = str[m.end():] # skip xml version tag
   (unmatched_str, unmatched_exprs) = match_xml_element(str, exprs)
   if unmatched_exprs:
-    print("Failed to find the following expressions:")
+    logger.warn("Failed to find the following expressions:")
     for expr in unmatched_exprs:
-      print(expr)
+      logger.warn(expr)
     raise svntest.tree.SVNTreeUnequal
 
 def match_xml_element(str, exprs):
@@ -115,7 +117,7 @@ def match_xml_element(str, exprs):
     content_re = re.compile(content_re_str % name, re.DOTALL)
     m = content_re.match(str)
     if not m:
-      print("No XML end-tag for '%s' found in '%s...'" % (name, str[:100]))
+      logger.warn("No XML end-tag for '%s' found in '%s...'" % (name, str[:100]))
       raise(svntest.tree.SVNTreeUnequal)
     content = m.group('content')
     str = str[m.end():]
@@ -299,13 +301,13 @@ def info_wcroot_abspaths(sbox):
       target = "(UNKNOWN)"
 
     if path is None:
-      print "No WC root path for '%s'" % (target)
+      logger.warn "No WC root path for '%s'" % (target)
       raise svntest.Failure
 
     if path != wcroot_abspath:
-      print("For target '%s'..." % (target))
-      print("   Reported WC root path: %s" % (path))
-      print("   Expected WC root path: %s" % (wcroot_abspath))
+      logger.warn("For target '%s'..." % (target))
+      logger.warn("   Reported WC root path: %s" % (path))
+      logger.warn("   Expected WC root path: %s" % (wcroot_abspath))
       raise svntest.Failure
 
   sbox.build(read_only=True)



Mime
View raw message