~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2011-02-14 12:03:05 UTC
  • mto: This revision was merged to the branch mainline in revision 5664.
  • Revision ID: andrew.bennetts@canonical.com-20110214120305-7l7iu1h6f13voeo7
Add release note.

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,
25
24
    errors,
26
25
    osutils,
27
26
    repository,
28
27
    tests,
29
28
    )
30
 
from bzrlib.repofmt.groupcompress_repo import RepositoryFormat2a
31
29
 
32
30
from bzrlib.tests import TestCase
33
31
 
58
56
        out = self.run_bzr_error([error_re], ['st',u'-\xe4'])
59
57
 
60
58
 
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
 
 
71
59
class TestDeprecationWarning(tests.TestCaseWithTransport):
72
60
    """The deprecation warning is controlled via a global variable:
73
61
    repository._deprecation_warning_done. As such, it can be emitted only once
79
67
 
80
68
    def setUp(self):
81
69
        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.')
92
70
        self.disable_deprecation_warning()
93
71
 
94
72
    def enable_deprecation_warning(self, repo=None):
101
79
 
102
80
    def make_obsolete_repo(self, path):
103
81
        # We don't want the deprecation raising during the repo creation
104
 
        format = controldir.format_registry.make_bzrdir("testobsolete")
105
 
        tree = self.make_branch_and_tree(path, format=format)
 
82
        tree = self.make_branch_and_tree(path, format=bzrdir.BzrDirFormat5())
106
83
        return tree
107
84
 
108
85
    def check_warning(self, present):