~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_repository.py

  • Committer: Jelmer Vernooij
  • Date: 2011-12-07 14:03:01 UTC
  • mto: (6213.1.25 feature-flags)
  • mto: This revision was merged to the branch mainline in revision 6353.
  • Revision ID: jelmer@samba.org-20111207140301-87aa1dcekem98tws
Add BzrDirMetaComponentFormat.

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
    def open(self, a_bzrdir, _found=False):
116
116
        return "opened repository."
117
117
 
 
118
    @classmethod
 
119
    def from_string(cls, format_string):
 
120
        return cls()
 
121
 
118
122
 
119
123
class SampleExtraRepositoryFormat(repository.RepositoryFormat):
120
124
    """A sample format that can not be used in a metadir
137
141
            dir = format._matchingbzrdir.initialize(url)
138
142
            format.initialize(dir)
139
143
            t = transport.get_transport_from_path(url)
140
 
            found_format = repository.RepositoryFormat.find_format(dir)
 
144
            found_format = repository.RepositoryFormatMetaDir.find_format(dir)
141
145
            self.assertIsInstance(found_format, format.__class__)
142
146
        check_format(repository.format_registry.get_default(), "bar")
143
147
 
144
148
    def test_find_format_no_repository(self):
145
149
        dir = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
146
150
        self.assertRaises(errors.NoRepositoryPresent,
147
 
                          repository.RepositoryFormat.find_format,
 
151
                          repository.RepositoryFormatMetaDir.find_format,
148
152
                          dir)
149
153
 
150
154
    def test_find_format_unknown_format(self):
151
155
        dir = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
152
156
        SampleRepositoryFormat().initialize(dir)
153
157
        self.assertRaises(UnknownFormatError,
154
 
                          repository.RepositoryFormat.find_format,
 
158
                          repository.RepositoryFormatMetaDir.find_format,
155
159
                          dir)
156
160
 
157
161
    def test_register_unregister_format(self):
438
442
 
439
443
class TestRepositoryFormat1(knitrepo.RepositoryFormatKnit1):
440
444
 
441
 
    def get_format_string(self):
 
445
    @classmethod
 
446
    def get_format_string(cls):
442
447
        return "Test Format 1"
443
448
 
444
449
 
445
450
class TestRepositoryFormat2(knitrepo.RepositoryFormatKnit1):
446
451
 
447
 
    def get_format_string(self):
 
452
    @classmethod
 
453
    def get_format_string(cls):
448
454
        return "Test Format 2"
449
455
 
450
456