Use print() function in both Python 2 and Python 3

Signed-off-by: cclauss <cclauss@me.com>
pull/4741/head
cclauss 2019-07-12 00:32:38 +02:00
parent f158c226c3
commit 610419df04
1 changed files with 10 additions and 9 deletions

View File

@ -20,6 +20,7 @@
https://k8s-testgrid.appspot.com
"""
from __future__ import print_function
import os, sys, json, re, argparse, calendar, time, subprocess, shlex
def get_classname(test_script):
@ -86,8 +87,8 @@ def upload_results(outdir, test_script, buildnum, bucket):
classname = get_classname(test_script)
args = shlex.split("gsutil cp -R gcs_out/ gs://%s/logs/%s/%s" % (bucket, classname, buildnum))
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in p.stdout:
print line
for line in str(p.stdout):
print(line)
def run_tests(test_script, log_path, exit_status, started, finished, test_results):
""" execute the test script, grab the start time, finish time, build logs and exit status
@ -109,9 +110,9 @@ def run_tests(test_script, log_path, exit_status, started, finished, test_result
classname = get_classname(test_script)
build_log_file = open(log_path, 'w')
p = subprocess.Popen(['bash','-x',test_script], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in p.stdout:
for line in str(p.stdout):
build_log_file.write(line)
print line.rstrip()
print(line.rstrip())
if '--- PASS' in line:
match = re.match('.*--- PASS: ([^ ]+) \(([0-9.]+)s\)', line)
(name, seconds) = match.group(1, 2)