Mercurial > public > mercurial-scm > hg-stable
diff tests/run-tests.py @ 52542:d63ab79ed01d
run-tests: small rework of the infamous lib warning to colorize it
I am about to add more dore around it and so I do the smaller change first.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 12 Dec 2024 15:06:48 +0000 |
parents | 824877fd613b |
children | 20690cff1bd8 |
line wrap: on
line diff
--- a/tests/run-tests.py Thu Dec 12 15:00:49 2024 +0000 +++ b/tests/run-tests.py Thu Dec 12 15:06:48 2024 +0000 @@ -4084,12 +4084,15 @@ # We cannot expect anything sensible here. return expecthg = os.path.join(self._pythondir, b'mercurial') - actualhg = self._gethgpath() - if os.path.abspath(actualhg) != os.path.abspath(expecthg): - sys.stderr.write( + actual_py_hg = self._get_hg_py_path() + if os.path.abspath(actual_py_hg) != os.path.abspath(expecthg): + msg = ( 'warning: %s with unexpected mercurial lib: %s\n' - ' (expected %s)\n' % (verb, actualhg, expecthg) + ' (expected %s)\n' ) + msg %= (verb, actual_py_hg.decode(), expecthg.decode()) + msg = colorize(msg, "yellow", self.options.color) + sys.stderr.write(msg) policy = self._get_hg_module_policy() msg = b"fatal: mercurial binary has unexpected flavor for %s: %s\n" err = None @@ -4127,7 +4130,7 @@ sys.exit(4) return out - def _gethgpath(self): + def _get_hg_py_path(self): """Return the path to the mercurial package that is actually found by the current Python interpreter.""" if self._hgpath is not None: