~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__dirstate_helpers.py

  • Committer: Jelmer Vernooij
  • Date: 2016-04-03 16:32:31 UTC
  • mto: This revision was merged to the branch mainline in revision 6617.
  • Revision ID: jelmer@jelmer.uk-20160403163231-h72bo0uyek2gikw0
Don't put French text in doc/en/user-reference when LANGUAGE=fr_CH.UTF_8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    errors,
26
26
    osutils,
27
27
    tests,
 
28
    _dirstate_helpers_py,
28
29
    )
29
30
from bzrlib.tests import (
30
31
    test_dirstate,
34
35
    load_tests_apply_scenarios,
35
36
    multiply_scenarios,
36
37
    )
 
38
from bzrlib.tests import (
 
39
    features,
 
40
    )
37
41
 
38
42
 
39
43
load_tests = load_tests_apply_scenarios
40
44
 
41
45
 
42
 
compiled_dirstate_helpers_feature = tests.ModuleAvailableFeature(
 
46
compiled_dirstate_helpers_feature = features.ModuleAvailableFeature(
43
47
    'bzrlib._dirstate_helpers_pyx')
44
48
 
45
49
 
57
61
    process_entry = compiled_dirstate_helpers_feature.module.ProcessEntryC
58
62
    pe_scenarios.append(('dirstate_Pyrex', {'_process_entry': process_entry}))
59
63
 
 
64
helper_scenarios = [('dirstate_Python', {'helpers': _dirstate_helpers_py})]
 
65
if compiled_dirstate_helpers_feature.available():
 
66
    helper_scenarios.append(('dirstate_Pyrex',
 
67
        {'helpers': compiled_dirstate_helpers_feature.module}))
 
68
 
60
69
 
61
70
class TestBisectPathMixin(object):
62
71
    """Test that _bisect_path_*() returns the expected values.
951
960
 
952
961
    def test_update_entry_symlink(self):
953
962
        """Update entry should read symlinks."""
954
 
        self.requireFeature(tests.SymlinkFeature)
 
963
        self.requireFeature(features.SymlinkFeature)
955
964
        state, entry = self.get_state_with_a()
956
965
        state.save()
957
966
        self.assertEqual(dirstate.DirState.IN_MEMORY_UNMODIFIED,
1148
1157
 
1149
1158
    def test_update_file_to_symlink(self):
1150
1159
        """File becomes a symlink"""
1151
 
        self.requireFeature(tests.SymlinkFeature)
 
1160
        self.requireFeature(features.SymlinkFeature)
1152
1161
        state, entry = self.get_state_with_a()
1153
1162
        # The file sha1 won't be cached unless the file is old
1154
1163
        state.adjust_time(+10)
1167
1176
 
1168
1177
    def test_update_dir_to_symlink(self):
1169
1178
        """Directory becomes a symlink"""
1170
 
        self.requireFeature(tests.SymlinkFeature)
 
1179
        self.requireFeature(features.SymlinkFeature)
1171
1180
        state, entry = self.get_state_with_a()
1172
1181
        # The symlink target won't be cached if it isn't old
1173
1182
        state.adjust_time(+10)
1177
1186
 
1178
1187
    def test_update_symlink_to_file(self):
1179
1188
        """Symlink becomes a file"""
1180
 
        self.requireFeature(tests.SymlinkFeature)
 
1189
        self.requireFeature(features.SymlinkFeature)
1181
1190
        state, entry = self.get_state_with_a()
1182
1191
        # The symlink and file info won't be cached unless old
1183
1192
        state.adjust_time(+10)
1187
1196
 
1188
1197
    def test_update_symlink_to_dir(self):
1189
1198
        """Symlink becomes a directory"""
1190
 
        self.requireFeature(tests.SymlinkFeature)
 
1199
        self.requireFeature(features.SymlinkFeature)
1191
1200
        state, entry = self.get_state_with_a()
1192
1201
        # The symlink target won't be cached if it isn't old
1193
1202
        state.adjust_time(+10)
1338
1347
class TestPackStat(tests.TestCase):
1339
1348
    """Check packed representaton of stat values is robust on all inputs"""
1340
1349
 
1341
 
    # GZ 2011-09-26: Should parametrise against all pack_stat implementations
 
1350
    scenarios = helper_scenarios
1342
1351
 
1343
 
    @staticmethod
1344
 
    def pack(statlike_tuple):
1345
 
        return dirstate.pack_stat(os.stat_result(statlike_tuple))
 
1352
    def pack(self, statlike_tuple):
 
1353
        return self.helpers.pack_stat(os.stat_result(statlike_tuple))
1346
1354
 
1347
1355
    @staticmethod
1348
1356
    def unpack_field(packed_string, stat_field):
1349
 
        return dirstate._unpack_stat(packed_string)[stat_field]
 
1357
        return _dirstate_helpers_py._unpack_stat(packed_string)[stat_field]
1350
1358
 
1351
1359
    def test_result(self):
1352
1360
        self.assertEqual("AAAQAAAAABAAAAARAAAAAgAAAAEAAIHk",