Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b60808a

Browse filesBrowse files
cclaussBethGriggs
authored andcommitted
tools: prepare tools/testp.py for Python 3
PR-URL: #24890 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
1 parent bf4faf3 commit b60808a
Copy full SHA for b60808a

File tree

Expand file treeCollapse file tree

1 file changed

+9
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-4
lines changed
Open diff view settings
Collapse file

‎tools/test.py‎

Copy file name to clipboardExpand all lines: tools/test.py
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,26 @@
4444
import multiprocessing
4545
import errno
4646
import copy
47-
import ast
4847

4948
from os.path import join, dirname, abspath, basename, isdir, exists
5049
from datetime import datetime
5150
from Queue import Queue, Empty
5251

5352
try:
54-
reduce # Python 2
53+
cmp # Python 2
54+
except NameError:
55+
def cmp(x, y): # Python 3
56+
return (x > y) - (x < y)
57+
58+
try:
59+
reduce # Python 2
5560
except NameError: # Python 3
5661
from functools import reduce
5762

5863
try:
59-
xrange # Python 2
64+
xrange # Python 2
6065
except NameError:
61-
xrange = range # Python 3
66+
xrange = range # Python 3
6267

6368
logger = logging.getLogger('testrunner')
6469
skip_regex = re.compile(r'# SKIP\S*\s+(.*)', re.IGNORECASE)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.