26
from bzrlib import osutils
26
from bzrlib import osutils, memorytree
28
28
from bzrlib.progress import _BaseProgressBar
29
29
from bzrlib.tests import (
33
TestCaseWithMemoryTransport,
33
34
TestCaseWithTransport,
434
435
self.assertEqual(self.test_home_dir, os.environ['HOME'])
438
class TestTestCaseWithMemoryTransport(TestCaseWithMemoryTransport):
440
def test_home_is_non_existant_dir_under_root(self):
441
"""The test_home_dir for TestCaseWithMemoryTransport is missing.
443
This is because TestCaseWithMemoryTransport is for tests that do not
444
need any disk resources: they should be hooked into bzrlib in such a
445
way that no global settings are being changed by the test (only a
446
few tests should need to do that), and having a missing dir as home is
447
an effective way to ensure that this is the case.
449
self.assertEqual(self.TEST_ROOT + "/MemoryTransportMissingHomeDir",
451
self.assertEqual(self.test_home_dir, os.environ['HOME'])
453
def test_cwd_is_TEST_ROOT(self):
454
self.assertEqual(self.test_dir, self.TEST_ROOT)
455
cwd = osutils.getcwd()
456
self.assertEqual(self.test_dir, cwd)
458
def test_make_branch_and_memory_tree(self):
459
"""In TestCaseWithMemoryTransport we should not make the branch on disk.
461
This is hard to comprehensively robustly test, so we settle for making
462
a branch and checking no directory was created at its relpath.
464
tree = self.make_branch_and_memory_tree('dir')
465
self.failIfExists('dir')
466
self.assertIsInstance(tree, memorytree.MemoryTree)
437
469
class TestTestCaseWithTransport(TestCaseWithTransport):
438
470
"""Tests for the convenience functions TestCaseWithTransport introduces."""
984
1016
self.assertIsInstance(bzrlib.bzrdir.BzrDir.open('b')._format,
985
1017
bzrlib.bzrdir.BzrDirFormat6)
987
def test_make_branch_and_mutable_tree(self):
1019
def test_make_branch_and_memory_tree(self):
988
1020
# we should be able to get a new branch and a mutable tree from
989
1021
# TestCaseWithTransport
990
1022
tree = self.make_branch_and_memory_tree('a')