~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__dirstate_helpers.py

  • Committer: Samuel Bronson
  • Date: 2012-08-30 20:36:18 UTC
  • mto: (6015.57.3 2.4)
  • mto: This revision was merged to the branch mainline in revision 6558.
  • Revision ID: naesten@gmail.com-20120830203618-y2dzw91nqpvpgxvx
Update INSTALL for switch to Python 2.6 and up.

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