[PATCH 1 of 2] test-patchbomb: convert the pretendmail program from *.sh to *.py

Matt Harbison mharbison72 at gmail.com
Mon Apr 10 21:17:32 EDT 2017


On Mon, 10 Apr 2017 08:52:52 -0400, Yuya Nishihara <yuya at tcha.org> wrote:

> On Sun, 09 Apr 2017 21:52:30 -0400, Matt Harbison wrote:
>> # HG changeset patch
>> # User Matt Harbison <matt_harbison at yahoo.com>
>> # Date 1491785368 14400
>> #      Sun Apr 09 20:49:28 2017 -0400
>> # Node ID 1de38b5ca1886aa41844dc7a80c1b92b65a8171e
>> # Parent  9259cf823690e4fcd34a4d2ecd57ced2060d2b3d
>> test-patchbomb: convert the pretendmail program from *.sh to *.py
>>
>> Windows doesn't know how to execute *.sh, so tests were failing with:
>>
>>   abort: 'pretendmail.py' specified as email transport, but not in PATH
>>
>> I was able to create a *.bat file to do the same thing, but neither the  
>> *.py nor
>> *.bat were able to read from stdin[1] and write to stdout on Windows,  
>> like `cat`
>> was doing in the shell script.  The *.py script is infinitely more  
>> readable.
>>
>> It isn't possible to specify 'method = python `pwd`/*.py', because  
>> everything
>> specified on the RHS ends up quoted, because of the space.  Therefore,  
>> $PATHEXT
>> is modified to include *.py, which causes a registry lookup and Windows  
>> to
>> figure out that it should open *.py with python.exe.  Unlike the python
>> installer, the MSYS installer doesn't add registry entries for *.sh, so  
>> it isn't
>> possible to execute shell scripts directly.
>
> Does it mean there's still a risk the test will fail? e.g. because .py is
> associated with python3, or not associated at all.

It seems like a small risk to be associated with something other than  
python, but not impossible.  If it was associated with python3, that seems  
OK since it's just reading stdin and writing to stdout (assuming this is  
valid py3 code- I didn't try that).

I'm fine with disabling the tests though.

> I think it's okay to disable the sendmail test at all on Windows because
> sendmail is a Unix thing.


More information about the Mercurial-devel mailing list