[PATCH] Windows testsuite fixes [1/4]

Andrew Bennetts andrew at canonical.com
Fri Dec 1 04:04:13 GMT 2006


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.


>          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)?

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.





More information about the bazaar mailing list