Author: hwright
Date: Fri May 25 00:14:23 2012
New Revision: 1342478
URL: http://svn.apache.org/viewvc?rev=1342478&view=rev
Log:
Use the logging module a bit more in the Python tests.
* subversion/tests/cmdline/getopt_tests.py,
subversion/tests/cmdline/lock_tests.py,
subversion/tests/cmdline/autoprop_tests.py:
s/print/logger.warn/
Modified:
subversion/trunk/subversion/tests/cmdline/autoprop_tests.py
subversion/trunk/subversion/tests/cmdline/getopt_tests.py
subversion/trunk/subversion/tests/cmdline/lock_tests.py
Modified: subversion/trunk/subversion/tests/cmdline/autoprop_tests.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/autoprop_tests.py?rev=1342478&r1=1342477&r2=1342478&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/autoprop_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/autoprop_tests.py Fri May 25
00:14:23 2012
@@ -25,7 +25,9 @@
######################################################################
# General modules
-import os
+import os, logging
+
+logger = logging.getLogger()
# Our testing module
import svntest
@@ -47,8 +49,8 @@ def check_proplist(path, exp_out):
props = svntest.tree.get_props([path]).get(path, {})
if props != exp_out:
- print("Expected properties: %s" % exp_out)
- print("Actual properties: %s" % props)
+ logger.warn("Expected properties: %s", exp_out)
+ logger.warn("Actual properties: %s", props)
raise svntest.Failure
Modified: subversion/trunk/subversion/tests/cmdline/getopt_tests.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/getopt_tests.py?rev=1342478&r1=1342477&r2=1342478&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/getopt_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/getopt_tests.py Fri May 25
00:14:23 2012
@@ -25,7 +25,9 @@
######################################################################
# General modules
-import sys, re, os.path
+import sys, re, os.path, logging
+
+logger = logging.getLogger()
# Our testing module
import svntest
@@ -138,31 +140,31 @@ def run_one_test(sbox, basename, *vararg
actual_stderr = process_lines(actual_stderr)
if exp_stdout != actual_stdout:
- print("Standard output does not match.")
- print("Expected standard output:")
- print("=====")
+ logger.warn("Standard output does not match.")
+ logger.warn("Expected standard output:")
+ logger.warn("=====")
for x in exp_stdout:
- sys.stdout.write(x)
- print("=====")
- print("Actual standard output:")
- print("=====")
+ logger.warn(x)
+ logger.warn("=====")
+ logger.warn("Actual standard output:")
+ logger.warn("=====")
for x in actual_stdout:
- sys.stdout.write(x)
- print("=====")
+ logger.warn(x)
+ logger.warn("=====")
raise svntest.Failure
if exp_stderr != actual_stderr:
- print("Standard error does not match.")
- print("Expected standard error:")
- print("=====")
+ logger.warn("Standard error does not match.")
+ logger.warn("Expected standard error:")
+ logger.warn("=====")
for x in exp_stderr:
- sys.stdout.write(x)
- print("=====")
- print("Actual standard error:")
- print("=====")
+ logger.warn(x)
+ logger.warn("=====")
+ logger.warn("Actual standard error:")
+ logger.warn("=====")
for x in actual_stderr:
- sys.stdout.write(x)
- print("=====")
+ logger.warn(x)
+ logger.warn("=====")
raise svntest.Failure
def getopt_no_args(sbox):
Modified: subversion/trunk/subversion/tests/cmdline/lock_tests.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/lock_tests.py?rev=1342478&r1=1342477&r2=1342478&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/lock_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/lock_tests.py Fri May 25 00:14:23
2012
@@ -26,7 +26,9 @@
######################################################################
# General modules
-import re, os, stat
+import re, os, stat, logging
+
+logger = logging.getLogger()
# Our testing module
import svntest
@@ -363,8 +365,8 @@ def enforce_lock(sbox):
if ((os.stat(iota_path)[0] & mode)
or (os.stat(lambda_path)[0] & mode)
or (os.stat(mu_path)[0] & mode)):
- print("Setting 'svn:needs-lock' property on a file failed to set")
- print("file mode to read-only.")
+ logger.warn("Setting 'svn:needs-lock' property on a file failed to set")
+ logger.warn("file mode to read-only.")
raise svntest.Failure
# obtain a lock on one of these files...
@@ -373,7 +375,7 @@ def enforce_lock(sbox):
# ...and verify that the write bit gets set...
if not (os.stat(iota_path)[0] & mode):
- print("Locking a file with 'svn:needs-lock' failed to set write bit.")
+ logger.warn("Locking a file with 'svn:needs-lock' failed to set write
bit.")
raise svntest.Failure
# ...and unlock it...
@@ -382,13 +384,13 @@ def enforce_lock(sbox):
# ...and verify that the write bit gets unset
if (os.stat(iota_path)[0] & mode):
- print("Unlocking a file with 'svn:needs-lock' failed to unset write
bit.")
+ logger.warn("Unlocking a file with 'svn:needs-lock' failed to unset
write bit.")
raise svntest.Failure
# Verify that removing the property restores the file to read-write
svntest.main.run_svn(None, 'propdel', 'svn:needs-lock', iota_path)
if not (os.stat(iota_path)[0] & mode):
- print("Deleting 'svn:needs-lock' failed to set write bit.")
+ logger.warn("Deleting 'svn:needs-lock' failed to set write bit.")
raise svntest.Failure
#----------------------------------------------------------------------
@@ -457,8 +459,8 @@ def defunct_lock(sbox):
# make sure that iota got set to read-only
if (os.stat(iota_path_b)[0] & mode):
- print("Upon removal of a defunct lock, a file with 'svn:needs-lock'")
- print("was not set back to read-only")
+ logger.warn("Upon removal of a defunct lock, a file with 'svn:needs-lock'")
+ logger.warn("was not set back to read-only")
raise svntest.Failure
@@ -672,7 +674,7 @@ def lock_non_existent_file(sbox):
if line.find(error_msg) != -1:
break
else:
- print("Error: %s : not found in: %s" % (error_msg, error))
+ logger.warn("Error: %s : not found in: %s" % (error_msg, error))
raise svntest.Failure
#----------------------------------------------------------------------
@@ -725,8 +727,8 @@ def revert_lock(sbox):
# make sure that iota got set to read-only
if (os.stat(iota_path)[0] & mode):
- print("Committing a file with 'svn:needs-lock'")
- print("did not set the file to read-only")
+ logger.warn("Committing a file with 'svn:needs-lock'")
+ logger.warn("did not set the file to read-only")
raise svntest.Failure
# verify status is as we expect
@@ -740,8 +742,8 @@ def revert_lock(sbox):
# make sure that iota got read-only-ness removed
if (os.stat(iota_path)[0] & mode == 0):
- print("Deleting the 'svn:needs-lock' property ")
- print("did not remove read-only-ness")
+ logger.warn("Deleting the 'svn:needs-lock' property ")
+ logger.warn("did not remove read-only-ness")
raise svntest.Failure
# revert the change
@@ -749,8 +751,8 @@ def revert_lock(sbox):
# make sure that iota got set back to read-only
if (os.stat(iota_path)[0] & mode):
- print("Reverting a file with 'svn:needs-lock'")
- print("did not set the file back to read-only")
+ logger.warn("Reverting a file with 'svn:needs-lock'")
+ logger.warn("did not set the file back to read-only")
raise svntest.Failure
# try propdel and revert from a different directory so
@@ -774,8 +776,8 @@ def revert_lock(sbox):
# make sure it is still writable since we have the lock
if (os.stat(iota_path)[0] & mode == 0):
- print("Reverting a 'svn:needs-lock' file (with lock in wc) ")
- print("did not leave the file writable")
+ logger.warn("Reverting a 'svn:needs-lock' file (with lock in wc) ")
+ logger.warn("did not leave the file writable")
raise svntest.Failure
@@ -959,8 +961,8 @@ def lock_and_exebit1(sbox):
if (not gamma_stat & mode_r
or gamma_stat & mode_w
or not gamma_stat & mode_x):
- print("Committing a file with 'svn:needs-lock, svn:executable'")
- print("did not set the file to read-only, executable")
+ logger.warn("Committing a file with 'svn:needs-lock, svn:executable'")
+ logger.warn("did not set the file to read-only, executable")
raise svntest.Failure
# lock
@@ -971,8 +973,8 @@ def lock_and_exebit1(sbox):
if (not gamma_stat & mode_r
or not gamma_stat & mode_w
or not gamma_stat & mode_x):
- print("Locking a file with 'svn:needs-lock, svn:executable'")
- print("did not set the file to read-write, executable")
+ logger.warn("Locking a file with 'svn:needs-lock, svn:executable'")
+ logger.warn("did not set the file to read-write, executable")
raise svntest.Failure
# modify
@@ -987,8 +989,8 @@ def lock_and_exebit1(sbox):
if (not gamma_stat & mode_r
or gamma_stat & mode_w
or not gamma_stat & mode_x):
- print("Unlocking a file with 'svn:needs-lock, svn:executable'")
- print("did not set the file to read-only, executable")
+ logger.warn("Unlocking a file with 'svn:needs-lock, svn:executable'")
+ logger.warn("did not set the file to read-only, executable")
raise svntest.Failure
# ci
@@ -1000,8 +1002,8 @@ def lock_and_exebit1(sbox):
if (not gamma_stat & mode_r
or gamma_stat & mode_w
or not gamma_stat & mode_x):
- print("Commiting a file with 'svn:needs-lock, svn:executable'")
- print("after unlocking modified file's permissions")
+ logger.warn("Commiting a file with 'svn:needs-lock, svn:executable'")
+ logger.warn("after unlocking modified file's permissions")
raise svntest.Failure
@@ -1036,8 +1038,8 @@ def lock_and_exebit2(sbox):
if (not gamma_stat & mode_r
or gamma_stat & mode_w
or not gamma_stat & mode_x):
- print("Committing a file with 'svn:needs-lock, svn:executable'")
- print("did not set the file to read-only, executable")
+ logger.warn("Committing a file with 'svn:needs-lock, svn:executable'")
+ logger.warn("did not set the file to read-only, executable")
raise svntest.Failure
# lock
@@ -1048,8 +1050,8 @@ def lock_and_exebit2(sbox):
if (not gamma_stat & mode_r
or not gamma_stat & mode_w
or not gamma_stat & mode_x):
- print("Locking a file with 'svn:needs-lock, svn:executable'")
- print("did not set the file to read-write, executable")
+ logger.warn("Locking a file with 'svn:needs-lock, svn:executable'")
+ logger.warn("did not set the file to read-write, executable")
raise svntest.Failure
# modify
@@ -1064,8 +1066,8 @@ def lock_and_exebit2(sbox):
if (not gamma_stat & mode_r
or gamma_stat & mode_w
or not gamma_stat & mode_x):
- print("Commiting a file with 'svn:needs-lock, svn:executable'")
- print("did not set the file to read-only, executable")
+ logger.warn("Commiting a file with 'svn:needs-lock, svn:executable'")
+ logger.warn("did not set the file to read-only, executable")
raise svntest.Failure
def commit_xml_unsafe_file_unlock(sbox):