[win32][BUG] url to filesystem???

John Arbash Meinel john at arbash-meinel.com
Thu Jun 15 03:09:24 BST 2006


Martin Pool wrote:
> On 14/06/2006, at 1:32 PM, John Arbash Meinel wrote:
> 
>> The bug was explicitly in the win32 handling of paths. So there really
>> isn't a way to catch that on non-win32.
>>
>> Otherwise we need to create a '_win32_split' function, so that we can
>> test it. And a very similar '_posix_split'.
>>
>> Right now in urlutils we have a 'if sys.platform == 'win32' for split
>> and strip_trailing_slash, and then local_path_to_url and
>> local_path_from_url are already switched in from
>> _win32_local_path_to_url.
>>
>> I'm sort of okay with doing multiple functions for 'split()' since
>> basename and dirname depend directly on it. I'm less okay with doing
>> that for all the callers up the stack.
>>
>> How would you like to handle it?
> 
> Well, my overriding concern is to have *some* test that will catch this
> if it regresses.  The behaviour can be executed equally well on
> non-win32, although it's not relevant to local paths, so it would be a
> bit of a shame not to test it everywhere.
> 
> I had imagined just say having _win32_split and _posix_split, and then
> setting split to point to either of them depending on the platform.
> 
> Alternatively if you want a smaller change then how about this: add a
> module variable
> 
>   platform = sys.platform
> 
> then a test can set/reset that to examine win32-specific behaviour.
> 
> --Martin

I fixed this up by pulling the win32 specific behavior into a separate
function, which can be separately tested. Having a 'platform=' isn't
quite right, because some things are selected at import time rather than
at runtime.

This isn't perfect either, since it doesn't guarantee that the upper
level function returns the right thing, but there is only so deep that
you can test.

Also, some things don't work right without being on the platform.
ntpath.abspath() actually is faked on non-win32 platforms.

John
=:->
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: win32-direct-tests.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20060614/cd4e6ef5/attachment.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060614/cd4e6ef5/attachment.pgp 


More information about the bazaar mailing list