run-test: clarify the error with a bad --with-hg is passed
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 09 Jul 2021 17:06:53 +0200
changeset 47583 05abe1ff1edd
parent 47582 6bceecb28806
child 47584 ee1fc8f970e6
run-test: clarify the error with a bad --with-hg is passed This helped me to understand what was going on when I got into trouble. Differential Revision: https://phab.mercurial-scm.org/D11046
tests/run-tests.py
tests/test-run-tests.t
--- a/tests/run-tests.py	Sat Jul 10 17:19:07 2021 +0200
+++ b/tests/run-tests.py	Fri Jul 09 17:06:53 2021 +0200
@@ -728,7 +728,9 @@
         ):
             parser.error('--with-hg must specify an executable hg script')
         if os.path.basename(options.with_hg) not in [b'hg', b'hg.exe']:
-            sys.stderr.write('warning: --with-hg should specify an hg script\n')
+            msg = 'warning: --with-hg should specify an hg script, not: %s\n'
+            msg %= _bytes2sys(os.path.basename(options.with_hg))
+            sys.stderr.write(msg)
             sys.stderr.flush()
 
     if (options.chg or options.with_chg) and WINDOWS:
--- a/tests/test-run-tests.t	Sat Jul 10 17:19:07 2021 +0200
+++ b/tests/test-run-tests.t	Fri Jul 09 17:06:53 2021 +0200
@@ -23,7 +23,7 @@
 #if symlink
   $ ln -s `which true` hg
   $ "$PYTHON" $TESTDIR/run-tests.py --with-hg=./hg
-  warning: --with-hg should specify an hg script
+  warning: --with-hg should specify an hg script, not: true
   running 0 tests using 0 parallel processes 
   
   # Ran 0 tests, 0 skipped, 0 failed.