/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_foreign.py

Some refactoring.

* bzrlib/tests/test_foreign.py:
(register_dummy_foreign_for_test): Factored out now that we have 3
uses.
(DummyForeignVcsTests): Use register_dummy_foreign_for_test.

* bzrlib/tests/blackbox/test_dpush.py:
(TestDpush, TestDpushStrictMixin): Use register_dummy_foreign_for_test.

Show diffs side-by-side

added added

removed removed

Lines of Context:
255
255
                hardlink=hardlink, stacked=stacked, source_branch=source_branch)
256
256
 
257
257
 
 
258
def register_dummy_foreign_for_test(testcase):
 
259
    bzrdir.BzrDirFormat.register_control_format(DummyForeignVcsDirFormat)
 
260
    testcase.addCleanup(bzrdir.BzrDirFormat.unregister_control_format,
 
261
                        DummyForeignVcsDirFormat)
 
262
    # We need to register the optimiser to make the dummy appears really
 
263
    # different from a regular bzr repository.
 
264
    branch.InterBranch.register_optimiser(InterToDummyVcsBranch)
 
265
    testcase.addCleanup(branch.InterBranch.unregister_optimiser,
 
266
                        InterToDummyVcsBranch)
 
267
 
 
268
 
258
269
class ForeignVcsRegistryTests(tests.TestCase):
259
270
    """Tests for the ForeignVcsRegistry class."""
260
271
 
316
327
    """Very basic test for DummyForeignVcs."""
317
328
 
318
329
    def setUp(self):
319
 
        bzrdir.BzrDirFormat.register_control_format(DummyForeignVcsDirFormat)
320
 
        branch.InterBranch.register_optimiser(InterToDummyVcsBranch)
321
 
        self.addCleanup(self.unregister)
322
330
        super(DummyForeignVcsTests, self).setUp()
323
 
 
324
 
    def unregister(self):
325
 
        try:
326
 
            bzrdir.BzrDirFormat.unregister_control_format(
327
 
                DummyForeignVcsDirFormat)
328
 
        except ValueError:
329
 
            pass
330
 
        branch.InterBranch.unregister_optimiser(InterToDummyVcsBranch)
 
331
        register_dummy_foreign_for_test(self)
331
332
 
332
333
    def test_create(self):
333
334
        """Test we can create dummies."""