~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_dirstate.py

Merge lockable-config-files into remove-gratuitous-ensure-config-dir-exist-calls resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    tests,
30
30
    )
31
31
from bzrlib.tests import test_osutils
32
 
from bzrlib.tests.scenarios import load_tests_apply_scenarios
33
32
 
34
33
 
35
34
# TODO:
45
44
# set_path_id  setting id when state is in memory modified
46
45
 
47
46
 
48
 
load_tests = load_tests_apply_scenarios
 
47
def load_tests(basic_tests, module, loader):
 
48
    suite = loader.suiteClass()
 
49
    dir_reader_tests, remaining_tests = tests.split_suite_by_condition(
 
50
        basic_tests, tests.condition_isinstance(TestCaseWithDirState))
 
51
    tests.multiply_tests(dir_reader_tests,
 
52
                         test_osutils.dir_reader_scenarios(), suite)
 
53
    suite.addTest(remaining_tests)
 
54
    return suite
49
55
 
50
56
 
51
57
class TestCaseWithDirState(tests.TestCaseWithTransport):
52
58
    """Helper functions for creating DirState objects with various content."""
53
59
 
54
 
    scenarios = test_osutils.dir_reader_scenarios()
55
 
 
56
60
    # Set by load_tests
57
61
    _dir_reader_class = None
58
62
    _native_to_unicode = None # Not used yet
726
730
 
727
731
class TestDirStateManipulations(TestCaseWithDirState):
728
732
 
729
 
    def test_update_minimal_updates_id_index(self):
730
 
        state = self.create_dirstate_with_root_and_subdir()
731
 
        self.addCleanup(state.unlock)
732
 
        id_index = state._get_id_index()
733
 
        self.assertEqual(['a-root-value', 'subdir-id'], sorted(id_index))
734
 
        state.add('file-name', 'file-id', 'file', None, '')
735
 
        self.assertEqual(['a-root-value', 'file-id', 'subdir-id'],
736
 
                         sorted(id_index))
737
 
        state.update_minimal(('', 'new-name', 'file-id'), 'f',
738
 
                             path_utf8='new-name')
739
 
        self.assertEqual(['a-root-value', 'file-id', 'subdir-id'],
740
 
                         sorted(id_index))
741
 
        self.assertEqual([('', 'new-name', 'file-id')],
742
 
                         sorted(id_index['file-id']))
743
 
        state._validate()
744
 
 
745
733
    def test_set_state_from_inventory_no_content_no_parents(self):
746
734
        # setting the current inventory is a slow but important api to support.
747
735
        tree1 = self.make_branch_and_memory_tree('tree1')