25
from bzrlib import osutils
25
from bzrlib import osutils, memorytree
27
27
from bzrlib.progress import _BaseProgressBar
28
28
from bzrlib.tests import (
32
TestCaseWithMemoryTransport,
32
33
TestCaseWithTransport,
432
433
self.assertEqual(self.test_home_dir, os.environ['HOME'])
436
class TestTestCaseWithMemoryTransport(TestCaseWithMemoryTransport):
438
def test_home_is_non_existant_dir_under_root(self):
439
"""The test_home_dir for TestCaseWithMemoryTransport is missing.
441
This is because TestCaseWithMemoryTransport is for tests that do not
442
need any disk resources: they should be hooked into bzrlib in such a
443
way that no global settings are being changed by the test (only a
444
few tests should need to do that), and having a missing dir as home is
445
an effective way to ensure that this is the case.
447
self.assertEqual(self.TEST_ROOT + "/MemoryTransportMissingHomeDir",
449
self.assertEqual(self.test_home_dir, os.environ['HOME'])
451
def test_cwd_is_TEST_ROOT(self):
452
self.assertEqual(self.test_dir, self.TEST_ROOT)
453
cwd = osutils.getcwd()
454
self.assertEqual(self.test_dir, cwd)
456
def test_make_branch_and_memory_tree(self):
457
"""In TestCaseWithMemoryTransport we should not make the branch on disk.
459
This is hard to comprehensively robustly test, so we settle for making
460
a branch and checking no directory was created at its relpath.
462
tree = self.make_branch_and_memory_tree('dir')
463
self.failIfExists('dir')
464
self.assertIsInstance(tree, memorytree.MemoryTree)
435
467
class TestTestCaseWithTransport(TestCaseWithTransport):
436
468
"""Tests for the convenience functions TestCaseWithTransport introduces."""