# HG changeset patch # User Pierre-Yves David # Date 1734016008 0 # Node ID d63ab79ed01d93a8ac2a66a7a0e05bec4b5f56d9 # Parent 824877fd613bf0ffb28afbababfce674dabd0cd5 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. diff -r 824877fd613b -r d63ab79ed01d tests/run-tests.py --- 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: