[PATCH] tests: unset variable HG if it is set
Patrick Mézard
patrick at mezard.eu
Sun Jul 29 04:28:42 CDT 2012
Le 28/07/12 22:46, Simon Heimberg a écrit :
> # HG changeset patch
> # User Simon Heimberg <simohe at besonet.ch>
> # Date 1343508145 -7200
> # Branch stable
> # Node ID 6fc30da0aaa93dba6b95d403749bb02a8bd44cf1
> # Parent c225042e2dae0bbc183245ef86ed6582cda58ba6
> tests: unset variable HG if it is set
>
> when hg tries to call itself it can call a different hg executable when this
> variable is set
>
> also add a short test which checks this and is executed as first test
>
> diff -r c225042e2dae -r 6fc30da0aaa9 tests/run-tests.py
> --- a/tests/run-tests.py Sam Jul 28 22:36:22 2012 +0200
> +++ b/tests/run-tests.py Sam Jul 28 22:42:25 2012 +0200
> @@ -1268,6 +1268,7 @@
> os.environ["HGPORT"] = str(options.port)
> os.environ["HGPORT1"] = str(options.port + 1)
> os.environ["HGPORT2"] = str(options.port + 2)
> + os.environ.pop("HG", None)
This will fail on platform not implementing unsetenv (Solaris?). What about checking $HG is in os.environ and if getattr(os, 'unsetenv', None) is not None, remove it and abort with a nice error message otherwise?
By the way, this code is suspicious:
http://selenic.com/hg/file/2a95830cff77/tests/run-tests.py#l1231
Either I am completely wrong about Solaris or it was never executed there.
Mads, any opinion?
>
> if options.with_hg:
> INST = None
> diff -r c225042e2dae -r 6fc30da0aaa9 tests/test-0checkvars.t
> --- /dev/null Don Jan 01 00:00:00 1970 +0000
> +++ b/tests/test-0checkvars.t Sam Jul 28 22:42:25 2012 +0200
> @@ -0,0 +1,7 @@
> + $ BINDIR=$(echo $PATH | cut -d ':' -f 1)
> +
> + $ which hg | sed s#$BINDIR#BINDIR#
> + BINDIR/hg
> +
> + $ echo $HG | sed s#$BINDIR#BINDIR#
> +
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
More information about the Mercurial-devel
mailing list