~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to 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
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
 
from bzrlib.ui import (
27
 
    CannedInputUIFactory,
 
19
from bzrlib import (
 
20
    errors,
 
21
    ui,
28
22
    )
29
 
 
30
 
 
31
 
class TestBreakLock(TestCaseWithRepository):
 
23
from bzrlib.tests import per_repository
 
24
 
 
25
 
 
26
class TestBreakLock(per_repository.TestCaseWithRepository):
32
27
 
33
28
    def setUp(self):
34
29
        super(TestBreakLock, self).setUp()
35
30
        self.unused_repo = self.make_repository('.')
36
31
        self.repo = self.unused_repo.bzrdir.open_repository()
37
 
        # we want a UI factory that accepts canned input for the tests:
38
 
        # while SilentUIFactory still accepts stdin, we need to customise
39
 
        # ours
40
 
        self.old_factory = bzrlib.ui.ui_factory
41
 
        self.addCleanup(self.restoreFactory)
42
 
        bzrlib.ui.ui_factory = CannedInputUIFactory([True])
43
 
 
44
 
    def restoreFactory(self):
45
 
        bzrlib.ui.ui_factory = self.old_factory
 
32
        ui.ui_factory = ui.CannedInputUIFactory([True])
46
33
 
47
34
    def test_unlocked(self):
48
35
        # break lock when nothing is locked should just return