~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-11 04:02:41 UTC
  • mfrom: (5017.2.2 tariff)
  • Revision ID: pqm@pqm.ubuntu.com-20100211040241-w6n021dz0uus341n
(mbp) add import-tariff tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2008, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2006 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 *
28
27
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
29
28
 
30
29
 
45
44
        self.assertFalse(wt.is_locked())
46
45
        self.assertFalse(wt.branch.is_locked())
47
46
 
48
 
    def test_lock_read_returns_unlocker(self):
49
 
        wt = self.make_branch_and_tree('.')
50
 
        self.assertThat(wt.lock_read, ReturnsUnlockable(wt))
51
 
 
52
47
    def test_trivial_lock_write_unlock(self):
53
48
        """Locking for write and unlocking should work trivially."""
54
49
        wt = self.make_branch_and_tree('.')
64
59
        self.assertFalse(wt.is_locked())
65
60
        self.assertFalse(wt.branch.is_locked())
66
61
 
67
 
    def test_lock_write_returns_unlocker(self):
68
 
        wt = self.make_branch_and_tree('.')
69
 
        self.assertThat(wt.lock_write, ReturnsUnlockable(wt))
70
 
 
71
62
    def test_trivial_lock_tree_write_unlock(self):
72
63
        """Locking for tree write is ok when the branch is not locked."""
73
64
        wt = self.make_branch_and_tree('.')
83
74
        self.assertFalse(wt.is_locked())
84
75
        self.assertFalse(wt.branch.is_locked())
85
76
 
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
 
 
90
77
    def test_trivial_lock_tree_write_branch_read_locked(self):
91
78
        """It is ok to lock_tree_write when the branch is read locked."""
92
79
        wt = self.make_branch_and_tree('.')