/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

Convert a bunch more features over to ModuleAvailableFeature

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
AttribFeature = _AttribFeature()
64
64
 
65
65
 
66
 
class _CompiledPatienceDiffFeature(Feature):
67
 
 
68
 
    def _probe(self):
69
 
        try:
70
 
            import bzrlib._patiencediff_c
71
 
        except ImportError:
72
 
            return False
73
 
        return True
74
 
 
75
 
    def feature_name(self):
76
 
        return 'bzrlib._patiencediff_c'
77
 
 
78
 
CompiledPatienceDiffFeature = _CompiledPatienceDiffFeature()
 
66
compiled_patiencediff = tests.ModuleAvailableFeature('bzrlib._patiencediff_c')
79
67
 
80
68
 
81
69
def udiff_lines(old, new, allow_binary=False):
1156
1144
 
1157
1145
class TestPatienceDiffLib_c(TestPatienceDiffLib):
1158
1146
 
1159
 
    _test_needs_features = [CompiledPatienceDiffFeature]
 
1147
    _test_needs_features = [compiled_patiencediff]
1160
1148
 
1161
1149
    def setUp(self):
1162
1150
        super(TestPatienceDiffLib_c, self).setUp()
1252
1240
 
1253
1241
class TestPatienceDiffLibFiles_c(TestPatienceDiffLibFiles):
1254
1242
 
1255
 
    _test_needs_features = [CompiledPatienceDiffFeature]
 
1243
    _test_needs_features = [compiled_patiencediff]
1256
1244
 
1257
1245
    def setUp(self):
1258
1246
        super(TestPatienceDiffLibFiles_c, self).setUp()
1264
1252
class TestUsingCompiledIfAvailable(TestCase):
1265
1253
 
1266
1254
    def test_PatienceSequenceMatcher(self):
1267
 
        if CompiledPatienceDiffFeature.available():
 
1255
        if compiled_patiencediff.available():
1268
1256
            from bzrlib._patiencediff_c import PatienceSequenceMatcher_c
1269
1257
            self.assertIs(PatienceSequenceMatcher_c,
1270
1258
                          bzrlib.patiencediff.PatienceSequenceMatcher)
1274
1262
                          bzrlib.patiencediff.PatienceSequenceMatcher)
1275
1263
 
1276
1264
    def test_unique_lcs(self):
1277
 
        if CompiledPatienceDiffFeature.available():
 
1265
        if compiled_patiencediff.available():
1278
1266
            from bzrlib._patiencediff_c import unique_lcs_c
1279
1267
            self.assertIs(unique_lcs_c,
1280
1268
                          bzrlib.patiencediff.unique_lcs)
1284
1272
                          bzrlib.patiencediff.unique_lcs)
1285
1273
 
1286
1274
    def test_recurse_matches(self):
1287
 
        if CompiledPatienceDiffFeature.available():
 
1275
        if compiled_patiencediff.available():
1288
1276
            from bzrlib._patiencediff_c import recurse_matches_c
1289
1277
            self.assertIs(recurse_matches_c,
1290
1278
                          bzrlib.patiencediff.recurse_matches)