summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2017-11-01 12:56:12 +0000
committerMichael Drake <michael.drake@codethink.co.uk>2017-11-26 15:22:48 +0000
commit777093d441ab01e8a15df0cc478cd05c4377c475 (patch)
treec7cec1d209adc7b79b008d53ebb4915878eed85b
parent8589835723af7d1bf11924b13e38cf4f818c81ab (diff)
downloadbuildsystem-tlsa/python-testrunner.tar.gz
buildsystem-tlsa/python-testrunner.tar.bz2
Python test runner: Convert from Python 2 to Python 3.tlsa/python-testrunner
-rw-r--r--makefiles/Makefile.tools1
-rw-r--r--testtools/testrunner.py12
2 files changed, 7 insertions, 6 deletions
diff --git a/makefiles/Makefile.tools b/makefiles/Makefile.tools
index 2dde372..e6bb7d5 100644
--- a/makefiles/Makefile.tools
+++ b/makefiles/Makefile.tools
@@ -282,6 +282,7 @@ MV ?= mv
PERL ?= perl
PYTHON ?= python
+PYTHON3 ?= python3
PKGCONFIG ?= PKG_CONFIG_PATH="$(PREFIX)/lib/pkgconfig:$(PKG_CONFIG_PATH)" pkg-config
diff --git a/testtools/testrunner.py b/testtools/testrunner.py
index 9d3aee8..6648372 100644
--- a/testtools/testrunner.py
+++ b/testtools/testrunner.py
@@ -1,4 +1,4 @@
-#!/bin/python
+#!/usr/bin/python3
#
# Testcase runner for NetSurf projects
#
@@ -13,7 +13,7 @@
import os
import sys
-import Queue
+import queue
import threading
import subprocess
@@ -41,11 +41,11 @@ LOG = open(os.path.join(builddir, "testlog"), "w")
def run_test(test_exe, test_data):
- io_q = Queue.Queue()
+ io_q = queue.Queue()
def output_collector(identifier, stream):
for line in stream:
- io_q.put((identifier, line.rstrip()))
+ io_q.put((identifier, line.decode("utf-8").rstrip()))
if not stream.closed:
stream.close()
@@ -109,7 +109,7 @@ with open(os.path.join(directory, "INDEX"), "r") as TINDEX:
continue
# Found one; decompose
- decomposed = filter(None, line.split('\t'))
+ decomposed = list(filter(None, line.split('\t')))
# Strip whitespace
test = decomposed[0].strip()
@@ -136,7 +136,7 @@ with open(os.path.join(directory, "INDEX"), "r") as TINDEX:
continue
# Found one; decompose
- ddecomposed = filter(None, dline.split('\t'))
+ ddecomposed = list(filter(None, dline.split('\t')))
# Strip whitespace
dtest = ddecomposed[0].strip()