[PATCH V4] run-tests: use hghave.py
Mads Kiilerich
mads at kiilerich.com
Wed Jun 20 21:06:34 UTC 2012
Adrian Buehlmann wrote, On 06/19/2012 01:45 PM:
> # HG changeset patch
> # User Adrian Buehlmann <adrian at cadifra.com>
> # Date 1340041060 -7200
> # Node ID 60e6c72cc6df5e3c1e8abd88c6949a6382e31411
> # Parent 79902f7e27df0eeae96d4d47d5c8a12fae2a0bb7
> run-tests: use hghave.py
>
> Eliminates the start of a subprocess for #if requirements checking.
>
> The has_xxx functions in hghave.py now get the path where they should do their
> check in.
...
> diff --git a/tests/run-tests.py b/tests/run-tests.py
> --- a/tests/run-tests.py
> +++ b/tests/run-tests.py
> @@ -54,6 +54,7 @@
> import time
> import re
> import threading
> +import hghave
This will introduce an import dependency from run-tests to the mercurial
that we are testing. I'm waiting for Matt to decide on that.
Avoiding code duplication is nice, but tight coupling is bad. If we
really wanted run-tests to be 'a mercurial extension' then it would be
completely different. It might however be worth it.
It is also possible that we should duplicate some code and remove the
mercurial imports from hghave.py before we start importing hghave.
> @@ -1306,6 +1301,11 @@
>
> COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
>
> + # insert root in sys.path, so mercurial can be imported in hghave
> + rootdir = os.path.realpath(os.path.join(TESTDIR, ".."))
> + if rootdir not in sys.path:
> + sys.path.insert(1, rootdir)
> +
In the case where we are testing without -l (and thus will create a temp
hg install) and haven't run 'make local' then this will point at a
mercurial without any compiled binary extensions. That might not be what
we want and wasn't what we did before.
/Mads
More information about the Mercurial-devel
mailing list