Patchwork [3,of,3,STABLE] tests: avoid unexpected result at invocation of *.py file on Windows

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Aug. 1, 2017, 11:52 a.m.
Message ID <d64e152fedf9b5e30423.1501588342@juju>
Download mbox | patch
Permalink /patch/22601/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - Aug. 1, 2017, 11:52 a.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1501518452 -32400
#      Tue Aug 01 01:27:32 2017 +0900
# Branch stable
# Node ID d64e152fedf9b5e30423d9684be204aa2fa1d792
# Parent  e5dac85fed4b0ebf699cc55374356a4020a7a891
# Available At https://bitbucket.org/foozy/mercurial-wip
#              hg pull https://bitbucket.org/foozy/mercurial-wip -r d64e152fedf9
# EXP-Topic tests-portability
tests: avoid unexpected result at invocation of *.py file on Windows

Invocation of "diff tool.py" in test-extdiff.t tests whether
shellquote() is applied on specified command as expected.

But direct invocation of "*.py" file might cause unexpected result on
Windows according to suffix binding.

For example, starting IDE, showing dialog to choose program to be
used, and so on. In such case, running test-extdiff.t is easily timed
out.

This patch uses intermediate *.bat file on Windows, to avoid such
unexpected result. Naming that intermediate file as "diff tool.bat" is
enough to test applying shellquote().
Augie Fackler - Aug. 1, 2017, 4:14 p.m.
On Tue, Aug 01, 2017 at 08:52:22PM +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1501518452 -32400
> #      Tue Aug 01 01:27:32 2017 +0900
> # Branch stable
> # Node ID d64e152fedf9b5e30423d9684be204aa2fa1d792
> # Parent  e5dac85fed4b0ebf699cc55374356a4020a7a891
> # Available At https://bitbucket.org/foozy/mercurial-wip
> #              hg pull https://bitbucket.org/foozy/mercurial-wip -r d64e152fedf9
> # EXP-Topic tests-portability
> tests: avoid unexpected result at invocation of *.py file on Windows

queued for stable (will be in 4.3), thanks

Patch

diff --git a/tests/test-extdiff.t b/tests/test-extdiff.t
--- a/tests/test-extdiff.t
+++ b/tests/test-extdiff.t
@@ -263,8 +263,16 @@  Prepare custom diff/edit tool:
 will change to /tmp/extdiff.TMP and populate directories a.TMP and a
 and start tool
 
+#if windows
+  $ cat > 'diff tool.bat' << EOF
+  > @$PYTHON "`pwd`/diff tool.py"
+  > EOF
+  $ hg extdiff -p "`pwd`/diff tool.bat"
+  [1]
+#else
   $ hg extdiff -p "`pwd`/diff tool.py"
   [1]
+#endif
 
 Diff in working directory, after: