aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/run_tests/port_server.py
diff options
context:
space:
mode:
authorGravatar siddharthshukla <s.shukla@jacobs-university.de>2016-07-07 16:08:01 +0200
committerGravatar siddharthshukla <s.shukla@jacobs-university.de>2016-07-12 01:35:53 +0200
commit0589e533cd65a2ca9e0e610cc1b284d016986572 (patch)
treea7848ae0a0cbb3fb94a49987d8bc33c3683d578b /tools/run_tests/port_server.py
parent7126163b92c4b6be0ed8f9954e29fd9965cd7bb6 (diff)
Make testing toolchain python 3.x compliant
six is necessary for making these scripts cross compatible between python 2.x and 3.x Changes: Add six to python_deps.include Include python_deps.include to all Dockerfile templates in test directory Include python_deps.include to all Dockerfile templates in stress_test directory Include python_deps.include to all Dockerfile templates in interop_test directory Replace print statements with print function calls (from futute..) Replace .iteritems() with .items() wherever necessary use six.moves to import BaseHTTPServer Generate new dockerfiles using generate_projects.sh
Diffstat (limited to 'tools/run_tests/port_server.py')
-rwxr-xr-xtools/run_tests/port_server.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/run_tests/port_server.py b/tools/run_tests/port_server.py
index 83f8e6cd35..e9b3f7ff79 100755
--- a/tools/run_tests/port_server.py
+++ b/tools/run_tests/port_server.py
@@ -30,8 +30,10 @@
"""Manage TCP ports for unit tests; started by run_tests.py"""
+from __future__ import print_function
+
import argparse
-import BaseHTTPServer
+from six.moves import BaseHTTPServer
import hashlib
import os
import socket
@@ -46,7 +48,7 @@ _MY_VERSION = 9
if len(sys.argv) == 2 and sys.argv[1] == 'dump_version':
- print _MY_VERSION
+ print(_MY_VERSION)
sys.exit(0)
@@ -62,7 +64,7 @@ if args.logfile is not None:
sys.stderr = open(args.logfile, 'w')
sys.stdout = sys.stderr
-print 'port server running on port %d' % args.port
+print('port server running on port %d' % args.port)
pool = []
in_use = {}
@@ -152,7 +154,7 @@ class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_header('Content-Type', 'text/plain')
self.end_headers()
now = time.time()
- self.wfile.write(yaml.dump({'pool': pool, 'in_use': dict((k, now - v) for k, v in in_use.iteritems())}))
+ self.wfile.write(yaml.dump({'pool': pool, 'in_use': dict((k, now - v) for k, v in in_use.items())}))
elif self.path == '/quitquitquit':
self.send_response(200)
self.end_headers()
@@ -164,4 +166,4 @@ while keep_running:
httpd.handle_request()
sys.stderr.flush()
-print 'done'
+print('done')