From f6842f15e941740200ad7fa39b18c7fab13716eb Mon Sep 17 00:00:00 2001 From: cclauss Date: Fri, 7 Dec 2018 11:04:24 +0100 Subject: [PATCH] tools: prepare tools/testp.py for Python 3 --- tools/test.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/test.py b/tools/test.py index be2179e6fb7410..ff20cb133cea6a 100755 --- a/tools/test.py +++ b/tools/test.py @@ -44,21 +44,26 @@ import multiprocessing import errno import copy -import ast from os.path import join, dirname, abspath, basename, isdir, exists from datetime import datetime from Queue import Queue, Empty try: - reduce # Python 2 + cmp # Python 2 +except NameError: + def cmp(x, y): # Python 3 + return (x > y) - (x < y) + +try: + reduce # Python 2 except NameError: # Python 3 from functools import reduce try: - xrange # Python 2 + xrange # Python 2 except NameError: - xrange = range # Python 3 + xrange = range # Python 3 logger = logging.getLogger('testrunner') skip_regex = re.compile(r'# SKIP\S*\s+(.*)', re.IGNORECASE)