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

Augie Fackler raf at durin42.com
Mon May 18 10:58:45 CDT 2015


# HG changeset patch
# User Augie Fackler <augie at 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.

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
 


More information about the Mercurial-devel mailing list