aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Peter Foley <pefoley2@pefoley.com>2015-07-06 12:19:58 +0000
committerGravatar Laszlo Csomor <laszlocsomor@google.com>2015-07-06 12:31:41 +0000
commit8e36c422255a99c8b3a7aac10b2d105294c7fa64 (patch)
treecfcba57147ddedccf5965dac7f72fb4da3569cc6
parent8cc19234977fb0fe68a9d28e435b5cd247a7de53 (diff)
Fix tests with python3 as default python.
If the system python interpreter is set to python3, some tests fail because python3 requires parenthesies for the print statement. Fix this by adding the required parenthesies, which are a no-op for python2. -- Reviewed-on: https://github.com/google/bazel/pull/282 MOS_MIGRATED_REVID=97571926
-rw-r--r--examples/py/bin.py2
-rwxr-xr-xsrc/test/shell/bazel/bazel_example_test.sh2
2 files changed, 2 insertions, 2 deletions
diff --git a/examples/py/bin.py b/examples/py/bin.py
index 53e917e491..f4a6666ddd 100644
--- a/examples/py/bin.py
+++ b/examples/py/bin.py
@@ -1,3 +1,3 @@
from examples.py import lib
-print "Fib(5)=%d" % lib.Fib(5)
+print("Fib(5)=%d" % lib.Fib(5))
diff --git a/src/test/shell/bazel/bazel_example_test.sh b/src/test/shell/bazel/bazel_example_test.sh
index 9eae7dfba8..4275cb7de8 100755
--- a/src/test/shell/bazel/bazel_example_test.sh
+++ b/src/test/shell/bazel/bazel_example_test.sh
@@ -117,7 +117,7 @@ function test_python() {
expect_log "Fib(5)=8"
# Mutate //examples/py:bin so that it needs to build again.
- echo "print 'Hello'" > ./examples/py/bin.py
+ echo "print('Hello')" > ./examples/py/bin.py
# Ensure that we can rebuild //examples/py::bin without error.
assert_build "//examples/py:bin"
./bazel-bin/examples/py/bin >& $TEST_log \