[PATCH 2 of 3] run-tests: fix _checkhglib() so it's correct when using --with-hg

Greg Ward greg-hg at gerg.ca
Mon May 18 21:55:19 CDT 2009


# HG changeset patch
# User Greg Ward <greg-hg at gerg.ca>
# Date 1242700659 14400
# Node ID 75d88fa8669b57c528b576f1e9620481004b4f65
# Parent  bb8131fcd7232b09192a9cba159c22ee7cec3f98
run-tests: fix _checkhglib() so it's correct when using --with-hg.

Since this makes the warning less likely, upgrade it to a "real"
warning to stderr.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -492,13 +492,15 @@
 
 def _checkhglib(verb):
     """Ensure that the 'mercurial' package imported by python is
-    the one we expect it to be.  If not, print a message to stdout."""
-    expecthg = os.path.join(HGTMP, 'install', 'lib', 'python', 'mercurial')
+    the one we expect it to be.  If not, print a warning to stderr."""
+    expecthg = os.path.join(PYTHONDIR, 'mercurial')
     global _actualhg
     if _actualhg is None:
         _actualhg = _hgpath()
     if _actualhg != expecthg:
-        print '# %s unexpected mercurial: %s' % (verb, _actualhg)
+        sys.stderr.write('warning: %s with unexpected mercurial lib: %s\n'
+                         '         (expected %s)\n'
+                         % (verb, _actualhg, expecthg))
 
 def runchildren(options, tests):
     if not options.with_hg:


More information about the Mercurial-devel mailing list