~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__chunks_to_lines.py

  • Committer: John Arbash Meinel
  • Date: 2010-01-12 22:36:23 UTC
  • mfrom: (4953 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4955.
  • Revision ID: john@arbash-meinel.com-20100112223623-836x5mou0gm5vsep
merge bzr.dev 4953 to clean up the ui factory issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
 
23
23
def load_tests(standard_tests, module, loader):
24
 
    # parameterize all tests in this module
25
 
    import bzrlib._chunks_to_lines_py as py_module
26
 
    scenarios = [('python', {'module': py_module})]
27
 
    if CompiledChunksToLinesFeature.available():
28
 
        import bzrlib._chunks_to_lines_pyx as c_module
29
 
        scenarios.append(('C', {'module': c_module}))
30
 
    else:
31
 
        # the compiled module isn't available, so we add a failing test
32
 
        class FailWithoutFeature(tests.TestCase):
33
 
            def test_fail(self):
34
 
                self.requireFeature(CompiledChunksToLinesFeature)
35
 
        standard_tests.addTest(FailWithoutFeature("test_fail"))
36
 
    return tests.multiply_tests(standard_tests, scenarios, loader.suiteClass())
37
 
 
38
 
 
39
 
class _CompiledChunksToLinesFeature(tests.Feature):
40
 
 
41
 
    def _probe(self):
42
 
        try:
43
 
            import bzrlib._chunks_to_lines_pyx
44
 
        except ImportError:
45
 
            return False
46
 
        return True
47
 
 
48
 
    def feature_name(self):
49
 
        return 'bzrlib._chunks_to_lines_pyx'
50
 
 
51
 
CompiledChunksToLinesFeature = _CompiledChunksToLinesFeature()
 
24
    suite, _ = tests.permute_tests_for_extension(
 
25
        standard_tests, loader, 'bzrlib._chunks_to_lines_py',
 
26
        'bzrlib._chunks_to_lines_pyx')
 
27
    return suite
 
28
 
 
29
# test_osutils depends on this feature being around. We can't just use the one
 
30
# generated by load_tests, because if we only load osutils but not this module,
 
31
# then that code never gets run
 
32
compiled_chunkstolines_feature = tests.ModuleAvailableFeature(
 
33
                                    'bzrlib._chunks_to_lines_pyx')
52
34
 
53
35
 
54
36
class TestChunksToLines(tests.TestCase):