Commit 8c054362 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Jérome Perrin

py2/py3: use print() in product.

parent 7463a7d4
......@@ -22,7 +22,7 @@ result = connection.getresponse()
path = result.getheader("X-Document-Location")
result.close()
path = '/%s' % '/'.join(path.split('/')[3:])
print path
print(path)
######################################
# Upload chunks
......
......@@ -53,7 +53,7 @@ def main():
threads[len(threads)-1].start()
request_number += 1
i+=1
print "thread: %i request: %i url: %s" % (i,request_number,url)
print("thread: %i request: %i url: %s" % (i,request_number,url))
else:
for t in range(0,max_thread):
if threads[t].isAlive() == 0:
......@@ -63,7 +63,7 @@ def main():
threads[t].start()
i+=1
request_number += 1
print "thread: %i request: %i url: %s" % (i,request_number,url)
print("thread: %i request: %i url: %s" % (i,request_number,url))
break
......@@ -146,17 +146,17 @@ class Checker(URLOpener):
thread.start()
while thread.isAlive():
sleep(0.5)
print "Connection to %s went fine" % url
print("Connection to %s went fine" % url)
except IOError as err:
(errno, strerror) = err.args
print "Can't connect to %s because of I/O error(%s): %s" % (url, errno, strerror)
print("Can't connect to %s because of I/O error(%s): %s" % (url, errno, strerror))
def SearchUrl(self, url=None):
try:
conn = self.open_http(url)
except IOError as err:
(errno, strerror) = err.args
print "Can't connect to %s because of I/O error(%s): %s" % (url, errno, strerror)
print("Can't connect to %s because of I/O error(%s): %s" % (url, errno, strerror))
def raise_error(self, error_key, field):
......
......@@ -188,8 +188,8 @@ class TestInvalidationBug(ERP5TypeTestCase):
module.setIdGenerator('_generatePerDayId')
#module.migrateToHBTree()
self.tic()
print 'OID(%s) = %r' % (module.getRelativeUrl(), module._p_oid)
print ' OID(_tree) = %r' % module._tree._p_oid
print('OID(%s) = %r' % (module.getRelativeUrl(), module._p_oid))
print(' OID(_tree) = %r' % module._tree._p_oid)
previous = DateTime()
skin_folder = self.getPortal().portal_skins.custom
if 'create_script' in skin_folder.objectIds():
......
......@@ -748,7 +748,7 @@ if validator_to_use == 'tidy':
warning = False
validator_path = '/usr/bin/tidy'
if not os.path.exists(validator_path):
print 'tidy is not installed at %s' % validator_path
print('tidy is not installed at %s' % validator_path)
else:
validator = TidyValidator(validator_path, show_warnings)
......
......@@ -27,5 +27,5 @@
##############################################################################
def say_hello():
print 'hello'
print('hello')
......@@ -438,10 +438,10 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
def _verboseErrorLog(self, size=10):
for entry in self.portal.error_log.getLogEntries()[:size]:
print "="*20
print "ERROR ID : %s" % entry["id"]
print "TRACEBACK :"
print entry["tb_text"]
print(("="*20))
print(("ERROR ID : %s" % entry["id"]))
print("TRACEBACK :")
print((entry["tb_text"]))
def testFunctionalTestRunner(self):
# Check the zuite page templates can be rendered, because selenium test
......
......@@ -33,4 +33,4 @@ class TestPystone(unittest.TestCase):
"""Tests to get pystone value
"""
def test_pystone(self):
print "PYSTONE RESULT (time,score) : %r" % (pystone.pystones(),)
print(("PYSTONE RESULT (time,score) : %r" % (pystone.pystones(),)))
......@@ -55,11 +55,11 @@ class TestSQLBench(unittest.TestCase):
sqlbench_path + '/test-alter-table',
'--database', database,
'--host', host, '--user', user, '--password', password]
print command_list
print(command_list)
process = subprocess.Popen(command_list,
cwd = sqlbench_path,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = process.communicate()
self.assertEqual(0, len(error), error)
print output
print(output)
self.assertTrue(output.find("Total time: ")>=0)
#!/usr/bin/env python2.7
from __future__ import absolute_import
from __future__ import print_function # six.PY2
import argparse, sys, os, textwrap
from erp5.util import taskdistribution
......@@ -8,7 +9,7 @@ from erp5.util import taskdistribution
from . import ERP5TypeTestSuite
def _parsingErrorHandler(data, _):
print >> sys.stderr, 'Error parsing data:', repr(data)
print('Error parsing data:', repr(data), file=sys.stderr)
taskdistribution.patchRPCParser(_parsingErrorHandler)
def makeSuite(
......@@ -119,8 +120,8 @@ def main():
args.zserver_frontend_url_list.split(',') if args.zserver_frontend_url_list else ())
if args.zserver_address_list and len(args.zserver_address_list) < args.node_quantity:
print >> sys.stderr, 'Not enough zserver address/frontends for node quantity %s (%r)' % (
args.node_quantity, args.zserver_address_list)
print('Not enough zserver address/frontends for node quantity %s (%r)' % (
args.node_quantity, args.zserver_address_list), file=sys.stderr)
sys.exit(1)
# sanity check
......
#!/usr/bin/env python2.7
from __future__ import print_function # six.PY2
import os
import sys
import pdb
......@@ -691,7 +692,7 @@ def runUnitTestList(test_list, verbosity=1, debug=0, run_only=None):
transaction.commit()
except:
import traceback
print "runUnitTestList Exception : %r" % (traceback.print_exc(),)
print("runUnitTestList Exception : %r" % (traceback.print_exc(),))
# finally does not expect opened transaction, even in the
# case of a Ctrl-C.
transaction.abort()
......@@ -725,10 +726,10 @@ def runUnitTestList(test_list, verbosity=1, debug=0, run_only=None):
def usage(stream, msg=None):
if msg:
print >>stream, msg
print >>stream
print(msg, file=stream)
print(file=stream)
program = os.path.basename(sys.argv[0])
print >>stream, __doc__ % {"program": program}
print(__doc__ % {"program": program}, file=stream)
log_directory = None
def main(argument_list=None):
......
from __future__ import absolute_import
from __future__ import print_function # six.PY2
import os
import logging
from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase
......@@ -44,8 +45,8 @@ class TransformTest(ATSiteTestCase):
output = open(output)
except IOError:
import sys
print >>sys.stderr, 'No output file found.'
print >>sys.stderr, 'File %s created, check it !' % self.output
print('No output file found.', file=sys.stderr)
print('File %s created, check it !' % self.output, file=sys.stderr)
output = open(output, 'w')
output.write(got)
output.close()
......@@ -238,7 +239,7 @@ def make_tests(test_descr=TRANSFORMS_TESTINFO):
continue
if TR_NAMES is not None and not _transform.name() in TR_NAMES:
print 'skip test for', _transform.name()
print('skip test for', _transform.name())
continue
class TransformTestSubclass(TransformTest):
......
......@@ -2,7 +2,7 @@ import sys
import httplib
if ( len(sys.argv) != 5 ):
print "usage tinyWebClient.py host port method path"
print("usage tinyWebClient.py host port method path")
else:
host = sys.argv[1]
port = sys.argv[2]
......@@ -10,7 +10,7 @@ else:
path = sys.argv[4]
info = (host, port)
print "%s:%s" % info
print("%s:%s" % info)
conn = httplib.HTTPConnection("%s:%s" % info)
conn.request(method, path)
print conn.getresponse().msg
print(conn.getresponse().msg)
......@@ -62,12 +62,12 @@ if __name__ == '__main__':
server_address = ('', port)
httpd = BaseHTTPServer.HTTPServer(server_address, HTTPHandler)
print "serving at port", port
print "To run the entire JsUnit test suite, open"
print("serving at port", port)
print("To run the entire JsUnit test suite, open")
print (" http://localhost:8000/jsunit/testRunner.html?testPage="
"http://localhost:8000/tests/JsUnitSuite.html&autoRun=true")
print "To run the acceptance test suite, open"
print " http://localhost:8000/TestRunner.html"
print("To run the acceptance test suite, open")
print(" http://localhost:8000/TestRunner.html")
while not HTTPHandler.quitRequestReceived :
httpd.handle_request()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment