Patchwork D12259: tests: move Python 3.5 check higher in file

login
register
mail settings
Submitter phabricator
Date March 2, 2022, 3:30 p.m.
Message ID <differential-rev-PHID-DREV-wxy33hacm5uyxaje2tqu-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50598/
State New
Headers show

Comments

phabricator - March 2, 2022, 3:30 p.m.
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Per code review comment on the changeset that introduced the Python 3.5+
  checks.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12259

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -72,6 +72,13 @@ 
 import uuid
 import xml.dom.minidom as minidom
 
+if sys.version_info < (3, 5, 0):
+    print(
+        '%s is only supported on Python 3.5+, not %s'
+        % (sys.argv[0], '.'.join(str(v) for v in sys.version_info[:3]))
+    )
+    sys.exit(70)  # EX_SOFTWARE from `man 3 sysexit`
+
 WINDOWS = os.name == r'nt'
 shellquote = shlex.quote
 
@@ -143,12 +150,6 @@ 
 
 origenviron = os.environ.copy()
 
-if sys.version_info < (3, 5, 0):
-    print(
-        '%s is only supported on Python 3.5+, not %s'
-        % (sys.argv[0], '.'.join(str(v) for v in sys.version_info[:3]))
-    )
-    sys.exit(70)  # EX_SOFTWARE from `man 3 sysexit`
 
 xrange = range  # we use xrange in one place, and we'd rather not use range