[MERGE] Cleanup and test Lock objects

John Arbash Meinel john at arbash-meinel.com
Wed Mar 14 14:28:40 GMT 2007


Alexander Belchenko wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> John Arbash Meinel пишет:
>> The attached patch cleans up the bzrlib/lock.py file a bit, and adds
>> direct test for our Lock support.
>>
>> I still have more to do to make locks properly exclusive on Linux. But
>> because that is a behavior change, I wanted to submit this first.
>>
>> This also implements Windows locks using ctypes if pywin32 is not
>> available. It turns out that msvcrt locks don't support creating a
>> shared lock, so we can no longer use them.
> 
> One more thing.
> Usually I have pywin32 installed, and ctypes too.
> It will be great if we have the way to test both implementations
> in one selftest run, without manual hiding/renaming/uninstalling pywin32.
> What you think about?
> 
> May be we can do in similar way as with different http transports,
> and test each available lock implementation by explicit name.
> In this case (IIUC) each lock implementation should have their
> unique name for direct access from test code.
> 
> [µ]

Well, they do have explicit names, but I realize they aren't always 
enabled. I can refactor it a bit more so we end up with a list of 
possible lock classes.

Either that, or we drop the pywin32 one entirely, and just make it a 
strict dependency on ctypes. Then we only have 2 lock objects. ctypes 
for win32, and fcntl everywhere else (including cygwin).

John
=:->




More information about the bazaar mailing list