[PATCH] Windows testsuite fixes [1/4]

John Arbash Meinel john at arbash-meinel.com
Fri Dec 1 13:51:44 GMT 2006


Andrew Bennetts wrote:
> On Thu, Nov 30, 2006 at 04:26:25PM +0100, Vincent Ladeuil wrote:
> [...]
>> +            spurious = [errno.EPIPE,
>> +                        errno.ECONNRESET,
>> +                        10053, # Windows 'Software caused connection abort'
>> +                        ]
>> +            if (len(e.args) > 0) and (e.args[0] in spurious):
> 
> I would expect 10053 to be errno.ECONNABORTED.  If it is, use that instead.
> 
> Otherwise, I'd rather not unconditionally include a hard-coded platform-specific
> number in spurious, but instead guard it with:
> 
>         if sys.platform == 'windows':
>             spurious.append(10053) # Software caused connection abort.
> 
> The reason is that hypothetically, that errno might occur on another platform
> with a different meaning.

I think you have a good point. I don't know of other platforms that use
error codes >10000, so I'm pretty sure it is windows specific. Though
you bring up that ECONNABORTED should probably be included in that list.

> 
> 
>>          out, err = self.run_bzr('init', 'subdir2/nothere', retcode=3)
>>          self.assertEqual('', out)
>> +        # Rely on bzr error message part only or we fail on
>> +        # non-english systems
>>          self.assertContainsRe(err,
>> -            r'^bzr: ERROR: .*'
>> -            '\[Errno 2\] No such file or directory')
>> -        
>> +            r'^bzr: ERROR: No such file:.*')
>> +
> 
> Can we do the equivalent of setting LANG=C on windows to avoid this problem?
> run_bzr happens in-process, so perhaps it should do
> "locale.setlocale(locale.LC_ALL, 'C')" (with an appropriate cleanup to restore
> the locale to the previous state)?

Well, I have been unsuccessful in getting LANG=C to mean anything on
Windows. So I'm not sure how it determines the locale and how to
generate internationalized error messages.

We have a good resource in Alexander, since his machine uses a
non-english Windows install.

It does seem like you can call 'setlocale'. But I wonder if there is
something that you could use when calling out to another process. (We
would like to use it when spawning an external diff).

> 
> Your solution seems ok for this instance, but in general run_bzr should probably
> ensure the test bzr is run in a predictable way.
> 
> Otherwise, +1 from me.
> 
> -Andrew.


John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061201/38d4e85f/attachment.pgp 


More information about the bazaar mailing list