Mercurial > public > mercurial-scm > hg-stable
changeset 53000:3fb2fbad4b13
test-fix-path: avoid a test hang on Windows
Windows can't typically invoke `*.py` directly as a command, and will instead
show a prompt asking what program should be used to open the file. We can't
directly invoke the interpreter as is usually done in this case, because the
whole point is to run something not in `PATH`. The easiest thing to do is
invoke a *.bat file that runs the interpreter. We can get away with this
because the current implementation is to effectively run `cmd.exe /c %command%`,
which doesn't need the file extension specified.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 20 Feb 2025 12:18:00 -0500 |
parents | e75ed9ae5fb9 |
children | b624da86830e |
files | tests/test-fix-path.t |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-fix-path.t Wed Feb 19 02:45:09 2025 +0100 +++ b/tests/test-fix-path.t Thu Feb 20 12:18:00 2025 -0500 @@ -20,8 +20,17 @@ > return re.sub(b' +', b' ', text.upper()) > stdout.write(format(stdin.read())) > EOF + $ chmod +x some/dir/uppercase.py +#if windows + $ cat > some/dir/uppercase.bat <<EOF + > @echo off + > "$PYTHON" "$TESTTMP/test-repo/some/dir/uppercase.py" + > EOF +#else + $ mv some/dir/uppercase.py some/dir/uppercase +#endif $ echo babar > babar.txt $ hg add babar.txt @@ -36,7 +45,7 @@ > evolution.allowunstable=True > [fix] > extra-bin-paths=$TESTTMP/test-repo/some/dir/ - > uppercase-whole-file:command=uppercase.py + > uppercase-whole-file:command=uppercase > uppercase-whole-file:pattern=set:**.txt > EOF