~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

``TestCase.make_branch_and_memory_tree`` now takes a format
option to set the BzrDir, Repository and Branch formats of the
created objects. (Robert Collins, John Arbash Meinel)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
import unittest
24
24
import warnings
25
25
 
26
 
from bzrlib import osutils, memorytree
27
26
import bzrlib
 
27
from bzrlib import (
 
28
    bzrdir,
 
29
    memorytree,
 
30
    osutils,
 
31
    repository,
 
32
    )
28
33
from bzrlib.progress import _BaseProgressBar
29
34
from bzrlib.tests import (
30
35
                          ChrootedTestCase,
465
470
        self.failIfExists('dir')
466
471
        self.assertIsInstance(tree, memorytree.MemoryTree)
467
472
 
 
473
    def test_make_branch_and_memory_tree_with_format(self):
 
474
        """make_branch_and_memory_tree should accept a format option."""
 
475
        format = bzrdir.BzrDirMetaFormat1()
 
476
        format.repository_format = repository.RepositoryFormat7()
 
477
        tree = self.make_branch_and_memory_tree('dir', format=format)
 
478
        self.failIfExists('dir')
 
479
        self.assertIsInstance(tree, memorytree.MemoryTree)
 
480
        self.assertEqual(format.repository_format.__class__,
 
481
            tree.branch.repository._format.__class__)
 
482
 
468
483
 
469
484
class TestTestCaseWithTransport(TestCaseWithTransport):
470
485
    """Tests for the convenience functions TestCaseWithTransport introduces."""