Patchwork D11078: sigpipe-remote: check for python version earlier in the script

login
register
mail settings
Submitter phabricator
Date July 11, 2021, 9:37 p.m.
Message ID <differential-rev-PHID-DREV-nrwr57i2hzgmeytuoxsl-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49392/
State Superseded
Headers show

Comments

phabricator - July 11, 2021, 9:37 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The should abort early, using the wrong python is a pretty bad sign.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/testlib/sigpipe-remote.py

CHANGE DETAILS




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

Patch

diff --git a/tests/testlib/sigpipe-remote.py b/tests/testlib/sigpipe-remote.py
--- a/tests/testlib/sigpipe-remote.py
+++ b/tests/testlib/sigpipe-remote.py
@@ -7,7 +7,11 @@ 
 import threading
 import time
 
-# we cannot use mercurial.testing as long as python2 is not dropped as the test will only install the mercurial module for python2 in python2 run
+# we cannot use mercurial.testing as long as python2 is not dropped as the test
+# will only install the mercurial module for python2 in python2 run
+if sys.version_info[0] < 3:
+    print('SIGPIPE-HELPER: script should run with Python 3', file=sys.stderr)
+    sys.exit(255)
 
 
 def _timeout_factor():
@@ -35,10 +39,6 @@ 
 
 # end of mercurial.testing content
 
-if sys.version_info[0] < 3:
-    print('SIGPIPE-HELPER: script should run with Python 3', file=sys.stderr)
-    sys.exit(255)
-
 
 def sysbytes(s):
     return s.encode('utf-8')