summaryrefslogtreecommitdiff
path: root/tools/regression_tester.py
diff options
context:
space:
mode:
authorDavid Ripton <dripton@redhat.com>2013-10-08 11:13:45 -0400
committerDavid Ripton <dripton@redhat.com>2013-10-08 11:13:45 -0400
commita52db496a5a8ac3ffd8598bf8bbe7e120b63d36b (patch)
tree401fc4fb2cde2dfa15d5b400a08382ed381915b2 /tools/regression_tester.py
parenta0546fd3f42c37e8cd6e4e9b70d59ae1e689b4b7 (diff)
downloadnova-a52db496a5a8ac3ffd8598bf8bbe7e120b63d36b.tar.gz
Use print function rather than print statement
This is for Python 3 compatibility, since Python 3 does not support the print statement, only the print function. (Python 2.6 and 2.7 support both, depending on whether a __future__ import is used.) Paths containing "xen" were left alone, because of comments in a couple of the files indicating that the XenServer code needed to be compatible with Python 2.4. Fixes bug 1226943 Change-Id: I23b804a4d99500b4acf81dd19645ab06dfcc9f1c
Diffstat (limited to 'tools/regression_tester.py')
-rwxr-xr-xtools/regression_tester.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/regression_tester.py b/tools/regression_tester.py
index aabd0d7940..89a5a4dd29 100755
--- a/tools/regression_tester.py
+++ b/tools/regression_tester.py
@@ -32,6 +32,8 @@ Due to the risk of false positives, the results from this need some human
interpretation.
"""
+from __future__ import print_function
+
import optparse
import string
import subprocess
@@ -39,12 +41,12 @@ import sys
def run(cmd, fail_ok=False):
- print "running: %s" % cmd
+ print("running: %s" % cmd)
obj = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
shell=True)
obj.wait()
if obj.returncode != 0 and not fail_ok:
- print "The above command terminated with an error."
+ print("The above command terminated with an error.")
sys.exit(obj.returncode)
return obj.stdout.read()
@@ -95,13 +97,13 @@ def main():
run("git checkout %s" % original_branch)
run("git branch -D %s" % new_branch)
- print expect_failure
- print ""
- print "*******************************"
+ print(expect_failure)
+ print("")
+ print("*******************************")
if test_works:
- print "FOUND a regression test"
+ print("FOUND a regression test")
else:
- print "NO regression test"
+ print("NO regression test")
sys.exit(1)