Patchwork [3,of,8,py3-cleanup] run-tests: introduce PYTHON3 boolean constant (issue4668)

login
register
mail settings
Submitter Augie Fackler
Date May 18, 2015, 3:58 p.m.
Message ID <877c7818c6cfd0893862.1431964722@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/9130/
State Accepted
Commit a8d22895a575ffaa88b8cf43ef6897b4b25b8503
Headers show

Comments

Augie Fackler - May 18, 2015, 3:58 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1431911553 14400
#      Sun May 17 21:12:33 2015 -0400
# Node ID 877c7818c6cfd08938627a76d3bb7731c6163a67
# Parent  ffb6e44e15533eb4f3884d42960c1d20f0095dfc
run-tests: introduce PYTHON3 boolean constant (issue4668)

This will avoid open-coding lots of version_info checks later in the
file.

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -79,7 +79,10 @@  except ImportError:
 processlock = threading.Lock()
 
 if sys.version_info > (3, 0, 0):
+    PYTHON3 = True
     xrange = range # we use xrange in one place, and we'd rather not use range
+else:
+    PYTHON3 = False
 
 def checkportisavailable(port):
     """return true if a port seems free to bind on localhost"""