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