[PATCH 3 of 3] run-tests: redefine --with-hg so it takes the 'hg' script to run

Greg Ward greg-hg at gerg.ca
Sun May 31 13:38:57 CDT 2009


On Sat, May 30, 2009 at 2:27 AM, Matt Mackall <mpm at selenic.com> wrote:
> This is mostly working. I'm having trouble with:
>
> ./run-tests -j 5 --local
[...]
> I've added this patch which sortof works, but I'm not sure if it's
> right. So for now I'm going to take patches one and two and your -v
> patch.
>
> diff -r ad8cfaba1637 tests/run-tests.py
> --- a/tests/run-tests.py        Sat May 30 01:14:19 2009 -0500
> +++ b/tests/run-tests.py        Sat May 30 01:17:27 2009 -0500
> @@ -34,6 +34,7 @@
>  SKIPPED_PREFIX = 'skipped: '
>  FAILED_PREFIX  = 'hghave check failed: '
>  PYTHON = sys.executable
> +PYTHONDIR = ''

I think I've got it at last.  The fix is:

--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -711,8 +711,13 @@
     if options.with_hg:
         INST = None
         BINDIR = os.path.dirname(os.path.realpath(options.with_hg))
-        # do not set PYTHONDIR: any code that uses it only works
-        # when we install our own Mercurial library
+
+        # This looks redundant with how Python initializes sys.path from
+        # the location of the script being executed.  Needed because the
+        # "hg" specified by --with-hg is not the only Python script
+        # executed in the test suite that needs to import 'mercurial'.
+        PYTHONDIR = BINDIR
     else:
         INST = os.path.join(HGTMP, "install")
         BINDIR = os.environ["BINDIR"] = os.path.join(INST, "bin")

...where the comment is at least as important than the code change.  ;-)

Will resend the whole patch in a few minutes, just as soon as I rebase
it on top of latest crew.

Greg



More information about the Mercurial-devel mailing list