Patchwork [6,of,8,py3-cleanup] run-tests: insist that if people use Python 3, they use 3.5.x

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

Comments

Augie Fackler - May 18, 2015, 3:58 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1431912364 14400
#      Sun May 17 21:26:04 2015 -0400
# Node ID 22ba83915d7a737ec293c9f602e0fad8da356490
# Parent  de8390275f7448bb48e7631f4f98ea422b2daec0
run-tests: insist that if people use Python 3, they use 3.5.x

We depend on both stdlib functionality (difflib.diff_bytes) and
language behavior (bytes formatting) introduced in 3.5, so let's try
and prevent some useless bug reports before they happen.

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -78,9 +78,13 @@  except ImportError:
 
 processlock = threading.Lock()
 
-if sys.version_info > (3, 0, 0):
+if sys.version_info > (3, 5, 0):
     PYTHON3 = True
     xrange = range # we use xrange in one place, and we'd rather not use range
+elif sys.version_info >= (3, 0, 0):
+    print('%s is only supported on Python 3.5+ and 2.6-2.7, not %s' %
+          (sys.argv[0], '.'.join(str(v) for v in sys.version_info[:3])))
+    sys.exit(70) # EX_SOFTWARE from `man 3 sysexit`
 else:
     PYTHON3 = False