/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Martin von Gagern
  • Date: 2010-04-20 08:47:38 UTC
  • mfrom: (5167 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5195.
  • Revision ID: martin.vgagern@gmx.net-20100420084738-ygymnqmdllzrhpfn
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006-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
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Tests for repository break-lock."""
18
18
 
19
 
from cStringIO import StringIO
20
 
 
21
 
import bzrlib
22
 
import bzrlib.errors as errors
23
 
from bzrlib.tests.per_repository.test_repository import TestCaseWithRepository
24
 
from bzrlib.transport import get_transport
25
 
from bzrlib.workingtree import WorkingTree
26
 
 
27
 
 
28
 
class TestBreakLock(TestCaseWithRepository):
 
19
from bzrlib import (
 
20
    errors,
 
21
    ui,
 
22
    )
 
23
from bzrlib.tests import per_repository
 
24
 
 
25
 
 
26
class TestBreakLock(per_repository.TestCaseWithRepository):
29
27
 
30
28
    def setUp(self):
31
29
        super(TestBreakLock, self).setUp()
32
30
        self.unused_repo = self.make_repository('.')
33
31
        self.repo = self.unused_repo.bzrdir.open_repository()
34
 
        # we want a UI factory that accepts canned input for the tests:
35
 
        # while SilentUIFactory still accepts stdin, we need to customise
36
 
        # ours
37
 
        self.old_factory = bzrlib.ui.ui_factory
38
 
        self.addCleanup(self.restoreFactory)
39
 
        bzrlib.ui.ui_factory = bzrlib.ui.SilentUIFactory()
40
 
        bzrlib.ui.ui_factory.stdin = StringIO("y\n")
41
 
 
42
 
    def restoreFactory(self):
43
 
        bzrlib.ui.ui_factory = self.old_factory
 
32
        ui.ui_factory = ui.CannedInputUIFactory([True])
44
33
 
45
34
    def test_unlocked(self):
46
35
        # break lock when nothing is locked should just return