~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2011-05-16 12:49:26 UTC
  • mto: This revision was merged to the branch mainline in revision 5872.
  • Revision ID: jelmer@samba.org-20110516124926-p1a13i5narhvqvdx
add tests for Repository.is_locked.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
        repo.lock_write()
37
37
        self.addCleanup(repo.unlock)
38
38
        self.assertTrue(repo.is_write_locked())
 
39
 
 
40
 
 
41
class TestIsLocked(TestCaseWithRepository):
 
42
 
 
43
    def test_not_locked(self):
 
44
        repo = self.make_repository('.')
 
45
        self.assertFalse(repo.is_locked())
 
46
 
 
47
    def test_read_locked(self):
 
48
        repo = self.make_repository('.')
 
49
        repo.lock_read()
 
50
        self.addCleanup(repo.unlock)
 
51
        self.assertTrue(repo.is_locked())
 
52
 
 
53
    def test_write_locked(self):
 
54
        repo = self.make_repository('.')
 
55
        repo.lock_write()
 
56
        self.addCleanup(repo.unlock)
 
57
        self.assertTrue(repo.is_locked())