~bzr/ubuntu/lucid/bzr/beta-ppa

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_workingtree/test_locking.py

  • Committer: Martin Pool
  • Date: 2010-08-18 04:26:39 UTC
  • mfrom: (129.1.8 packaging-karmic)
  • Revision ID: mbp@sourcefrog.net-20100818042639-mjoxtngyjwiu05fo
* PPA rebuild for lucid.
* PPA rebuild for karmic.
* PPA rebuild onto jaunty.
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006, 2008, 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
24
24
    lockdir,
25
25
    )
26
26
from bzrlib.tests import TestSkipped
 
27
from bzrlib.tests.matchers import *
27
28
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
28
29
 
29
30
 
44
45
        self.assertFalse(wt.is_locked())
45
46
        self.assertFalse(wt.branch.is_locked())
46
47
 
 
48
    def test_lock_read_returns_unlocker(self):
 
49
        wt = self.make_branch_and_tree('.')
 
50
        self.assertThat(wt.lock_read, ReturnsUnlockable(wt))
 
51
 
47
52
    def test_trivial_lock_write_unlock(self):
48
53
        """Locking for write and unlocking should work trivially."""
49
54
        wt = self.make_branch_and_tree('.')
59
64
        self.assertFalse(wt.is_locked())
60
65
        self.assertFalse(wt.branch.is_locked())
61
66
 
 
67
    def test_lock_write_returns_unlocker(self):
 
68
        wt = self.make_branch_and_tree('.')
 
69
        self.assertThat(wt.lock_write, ReturnsUnlockable(wt))
 
70
 
62
71
    def test_trivial_lock_tree_write_unlock(self):
63
72
        """Locking for tree write is ok when the branch is not locked."""
64
73
        wt = self.make_branch_and_tree('.')
74
83
        self.assertFalse(wt.is_locked())
75
84
        self.assertFalse(wt.branch.is_locked())
76
85
 
 
86
    def test_lock_tree_write_returns_unlocker(self):
 
87
        wt = self.make_branch_and_tree('.')
 
88
        self.assertThat(wt.lock_tree_write, ReturnsUnlockable(wt))
 
89
 
77
90
    def test_trivial_lock_tree_write_branch_read_locked(self):
78
91
        """It is ok to lock_tree_write when the branch is read locked."""
79
92
        wt = self.make_branch_and_tree('.')