~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_exceptions.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-03-03 06:02:49 UTC
  • mfrom: (5672.1.7 branch-revs-to-fetch)
  • Revision ID: pqm@pqm.ubuntu.com-20110303060249-l2zou9i59742nrqf
(spiv) Add Branch.heads_to_fetch API and HPSS request. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from bzrlib import (
22
22
    bzrdir,
23
23
    config,
 
24
    controldir,
24
25
    errors,
25
26
    osutils,
26
27
    repository,
27
28
    tests,
28
29
    )
 
30
from bzrlib.repofmt.groupcompress_repo import RepositoryFormat2a
29
31
 
30
32
from bzrlib.tests import TestCase
31
33
 
56
58
        out = self.run_bzr_error([error_re], ['st',u'-\xe4'])
57
59
 
58
60
 
 
61
class TestObsoleteRepoFormat(RepositoryFormat2a):
 
62
 
 
63
    @classmethod
 
64
    def get_format_string(cls):
 
65
        return "Test Obsolete Repository Format"
 
66
 
 
67
    def is_deprecated(self):
 
68
        return True
 
69
 
 
70
 
59
71
class TestDeprecationWarning(tests.TestCaseWithTransport):
60
72
    """The deprecation warning is controlled via a global variable:
61
73
    repository._deprecation_warning_done. As such, it can be emitted only once
67
79
 
68
80
    def setUp(self):
69
81
        super(TestDeprecationWarning, self).setUp()
 
82
        self.addCleanup(repository.format_registry.remove,
 
83
            TestObsoleteRepoFormat)
 
84
        repository.format_registry.register(TestObsoleteRepoFormat)
 
85
        self.addCleanup(controldir.format_registry.remove, "testobsolete")
 
86
        bzrdir.register_metadir(controldir.format_registry, "testobsolete",
 
87
            "bzrlib.tests.blackbox.test_exceptions.TestObsoleteRepoFormat",
 
88
            branch_format='bzrlib.branch.BzrBranchFormat7',
 
89
            tree_format='bzrlib.workingtree.WorkingTreeFormat6',
 
90
            deprecated=True,
 
91
            help='Same as 2a, but with an obsolete repo format.')
70
92
        self.disable_deprecation_warning()
71
93
 
72
94
    def enable_deprecation_warning(self, repo=None):
79
101
 
80
102
    def make_obsolete_repo(self, path):
81
103
        # We don't want the deprecation raising during the repo creation
82
 
        tree = self.make_branch_and_tree(path, format=bzrdir.BzrDirFormat5())
 
104
        format = controldir.format_registry.make_bzrdir("testobsolete")
 
105
        tree = self.make_branch_and_tree(path, format=format)
83
106
        return tree
84
107
 
85
108
    def check_warning(self, present):