[PATCH V4] run-tests: use hghave.py
Adrian Buehlmann
adrian at cadifra.com
Tue Jun 19 07:11:10 CDT 2012
On 2012-06-19 13:45, Adrian Buehlmann wrote:
> # 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.
Differences to V3:
> diff --git a/tests/hghave b/tests/hghave
> --- a/tests/hghave
> +++ b/tests/hghave
[..]
> @@ -37,30 +37,30 @@
> except ImportError:
> return False
>
> -def has_cvs():
> +def has_cvs(wd):
> re = r'Concurrent Versions System.*?server'
> - return matchoutput('cvs --version 2>&1', re) and not has_msys()
> + return matchoutput('cvs --version 2>&1', re) and not has_msys(wd)
>
The has_msys call now got the missing wd parameter
[..]
> diff --git a/tests/run-tests.py b/tests/run-tests.py
> --- a/tests/run-tests.py
> +++ b/tests/run-tests.py
[..]
> @@ -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)
> +
> vlog("# Using TESTDIR", TESTDIR)
> vlog("# Using HGTMP", HGTMP)
> vlog("# Using PATH", os.environ["PATH"])
I'm now injecting the root dir of the repo into Python's sys.path, so
that if a function in hghave.py imports mercurial it can be found.
(Fixes http://selenic.com/pipermail/mercurial-devel/2012-June/041648.html)
More information about the Mercurial-devel
mailing list