Skip to content

Commit

Permalink
tools: prepare tools/testp.py for Python 3
Browse files Browse the repository at this point in the history
PR-URL: #24890
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Franziska Hinkelmann <[email protected]>
  • Loading branch information
cclauss authored and BethGriggs committed Feb 20, 2019
1 parent 2605b6c commit 2f59dcd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2f59dcd

Please sign in to comment.