Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: prepare tools/testp.py for Python 3 #24890

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions tools/test.py
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