changeset 47636:b2ed9480b34a

sigpipe-remote: check for python version earlier in the script The should abort early, using the wrong python is a pretty bad sign. Differential Revision: https://phab.mercurial-scm.org/D11078
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 11 Jul 2021 15:40:06 +0200
parents 752109dc2fb7
children d0c0d7b98014
files tests/testlib/sigpipe-remote.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tests/testlib/sigpipe-remote.py	Sat Jul 10 13:46:35 2021 +0200
+++ b/tests/testlib/sigpipe-remote.py	Sun Jul 11 15:40:06 2021 +0200
@@ -7,7 +7,11 @@
 import sys
 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)
 
 if isinstance(sys.stdout.buffer, io.BufferedWriter):
     print('SIGPIPE-HELPER: script need unbuffered output', file=sys.stderr)
@@ -54,10 +58,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')