Tests: Set sys.stdout as utf8

This commit is contained in:
Paul Beckingham 2016-11-21 22:39:54 -05:00
parent 29d155afd7
commit 6d147cc99a

View file

@ -12,6 +12,9 @@ from multiprocessing import cpu_count
from threading import Thread
from subprocess import call, Popen, PIPE
if sys.version_info > (3,):
import codecs
try:
# python 2
from Queue import Queue, Empty
@ -19,6 +22,9 @@ except ImportError:
# python 3
from queue import Queue, Empty
# Look for taskd in $PATH instead of task/src/
os.environ["TASKD_USE_PATH"] = "1"
TIMEOUT = .2
@ -57,7 +63,10 @@ def run_test(testqueue, outqueue, threadname):
class TestRunner(object):
def __init__(self):
self.threads = []
self.tap = open(cmd_args.tapfile, 'w')
if sys.version_info > (3,):
self.tap = open(cmd_args.tapfile, 'w', errors='ignore')
else:
self.tap = open(cmd_args.tapfile, 'w')
self._parallelq = Queue()
self._serialq = Queue()
@ -194,6 +203,9 @@ def parse_args():
def main():
if sys.version_info > (3,):
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
runner = TestRunner()
runner.start()