Rev 2426: Change the DirState.test_initialize test so that we don't try to read a locked file. in http://bzr.arbash-meinel.com/branches/bzr/0.16-dev/dirstate_locking_fixes
John Arbash Meinel
john at arbash-meinel.com
Thu Apr 19 19:28:50 BST 2007
At http://bzr.arbash-meinel.com/branches/bzr/0.16-dev/dirstate_locking_fixes
------------------------------------------------------------
revno: 2426
revision-id: john at arbash-meinel.com-20070419182756-rdg6e8zoaxy9mg9q
parent: pqm at pqm.ubuntu.com-20070417080415-5vn25svmf95ki88z
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate_locking_fixes
timestamp: Thu 2007-04-19 13:27:56 -0500
message:
Change the DirState.test_initialize test so that we don't try to read a locked file.
modified:
bzrlib/tests/test_dirstate.py test_dirstate.py-20060728012006-d6mvoihjb3je9peu-2
-------------- next part --------------
=== modified file 'bzrlib/tests/test_dirstate.py'
--- a/bzrlib/tests/test_dirstate.py 2007-03-26 08:16:45 +0000
+++ b/bzrlib/tests/test_dirstate.py 2007-04-19 18:27:56 +0000
@@ -173,7 +173,7 @@
state.save()
finally:
state.unlock()
- del state # Callers should unlock
+ del state
state = dirstate.DirState.on_file('dirstate')
state.lock_read()
try:
@@ -648,12 +648,14 @@
try:
self.assertIsInstance(state, dirstate.DirState)
lines = state.get_lines()
- self.assertFileEqual(''.join(state.get_lines()),
- 'dirstate')
- self.check_state_with_reopen(expected_result, state)
- except:
+ finally:
state.unlock()
- raise
+ # On win32 you can't read from a locked file, even within the same
+ # process. So we have to unlock and release before we check the file
+ # contents.
+ self.assertFileEqual(''.join(lines), 'dirstate')
+ state.lock_read() # check_state_with_reopen will unlock
+ self.check_state_with_reopen(expected_result, state)
class TestDirStateManipulations(TestCaseWithDirState):
More information about the bazaar-commits
mailing list