~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-02-17 17:11:16 UTC
  • mfrom: (4797.2.17 2.1)
  • mto: (4797.2.18 2.1)
  • mto: This revision was merged to the branch mainline in revision 5055.
  • Revision ID: john@arbash-meinel.com-20100217171116-h7t9223ystbnx5h8
merge bzr.2.1 in preparation for NEWS entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008 Canonical Ltd
 
1
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
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):