~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_repository.py

  • Committer: Vincent Ladeuil
  • Date: 2012-01-05 16:19:30 UTC
  • mto: This revision was merged to the branch mainline in revision 6437.
  • Revision ID: v.ladeuil+lp@free.fr-20120105161930-bh6bwqnt9tvv902f
Tweak news entry to conflict on merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
153
153
            SampleRepositoryFormat.from_string(
154
154
                "Sample .bzr repository format."),
155
155
            SampleRepositoryFormat)
156
 
        self.assertRaises(AssertionError,
 
156
        self.assertRaises(ValueError,
157
157
            SampleRepositoryFormat.from_string,
158
158
                "Different .bzr repository format.")
159
159
 
164
164
                          repository.RepositoryFormatMetaDir.find_format,
165
165
                          dir)
166
166
 
167
 
    def test_find_format_with_features(self):
168
 
        tree = self.make_branch_and_tree('.', format='2a')
169
 
        tree.branch.repository.update_feature_flags({"name": "necessity"})
170
 
        found_format = repository.RepositoryFormatMetaDir.find_format(tree.bzrdir)
171
 
        self.assertIsInstance(found_format, repository.RepositoryFormatMetaDir)
172
 
        self.assertEquals(found_format.features.get("name"), "necessity")
173
 
        self.assertRaises(errors.MissingFeature, found_format.check_support_status,
174
 
            True)
175
 
        self.addCleanup(repository.RepositoryFormatMetaDir.unregister_feature,
176
 
            "name")
177
 
        repository.RepositoryFormatMetaDir.register_feature("name")
178
 
        found_format.check_support_status(True)
179
 
 
180
167
    def test_register_unregister_format(self):
181
168
        # Test deprecated format registration functions
182
169
        format = SampleRepositoryFormat()
1716
1703
        lazy = repository._LazyListJoin(['a'], ['b'])
1717
1704
        self.assertEqual("bzrlib.repository._LazyListJoin((['a'], ['b']))",
1718
1705
                         repr(lazy))
1719
 
 
1720
 
 
1721
 
class TestFeatures(tests.TestCaseWithTransport):
1722
 
 
1723
 
    def test_open_with_present_feature(self):
1724
 
        self.addCleanup(
1725
 
            repository.RepositoryFormatMetaDir.unregister_feature,
1726
 
            "makes-cheese-sandwich")
1727
 
        repository.RepositoryFormatMetaDir.register_feature(
1728
 
            "makes-cheese-sandwich")
1729
 
        repo = self.make_repository('.')
1730
 
        repo.lock_write()
1731
 
        repo._format.features["makes-cheese-sandwich"] = "required"
1732
 
        repo._format.check_support_status(False)
1733
 
        repo.unlock()
1734
 
 
1735
 
    def test_open_with_missing_required_feature(self):
1736
 
        repo = self.make_repository('.')
1737
 
        repo.lock_write()
1738
 
        repo._format.features["makes-cheese-sandwich"] = "required"
1739
 
        self.assertRaises(errors.MissingFeature,
1740
 
            repo._format.check_support_status, False)