[PATCH] tests: stabilize test-patch.t on Windows

Yuya Nishihara yuya at tcha.org
Mon May 21 07:58:16 EDT 2018


On Sun, 20 May 2018 23:06:44 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1526871918 14400
> #      Sun May 20 23:05:18 2018 -0400
> # Node ID 341bec645529aa249423f3aa683dac876d9e1510
> # Parent  6acf41bb8d40c55073e846b81c7466f4b0d390dc
> tests: stabilize test-patch.t on Windows
> 
> $PYTHON needs to be quoted when invoking with cmd.exe, because the value expands
> to c:/Python27/python.exe, which seems to be interpreted as 'c' being a command.
> We can't just convert to '\', because there are a few places that run $PYTHON
> directly in MSYS.  If unquoted there, it results in c:Python27python.exe being
> run.  I wonder if we should bake the quotes into the environment variable to
> avoid this.
> 
> It also wasn't happy with the quoting around exit1.py:
> 
>   c:/Python27/python.exe: can't open file ''$TESTTMP/d/exit1.py'': [Errno 22] Invalid argument
> 
> diff --git a/tests/test-patch.t b/tests/test-patch.t
> --- a/tests/test-patch.t
> +++ b/tests/test-patch.t
> @@ -97,7 +97,7 @@ Error exit (issue4746)
>    > sys.exit(1)
>    > EOF
>  
> -  $ hg import ../c/p --config ui.patch="$PYTHON '`pwd`/exit1.py'"
> +  $ hg import ../c/p --config ui.patch="\"$PYTHON\" `pwd`/exit1.py"

Perhaps \"`pwd`/exit1.py\" would be more correct since theoretically `pwd` may
contain whitespace.


More information about the Mercurial-devel mailing list