~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__rio.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-11-17 03:20:35 UTC
  • mfrom: (4792.4.3 456036)
  • Revision ID: pqm@pqm.ubuntu.com-20091117032035-s3sgtlixj1lrminn
(Gordon Tyler) Fix IndexError during 'bzr ignore /' (#456036)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
 
25
25
def load_tests(standard_tests, module, loader):
26
 
    suite, _ = tests.permute_tests_for_extension(standard_tests, loader,
27
 
        'bzrlib._rio_py', 'bzrlib._rio_pyx')
 
26
    # parameterize all tests in this module
 
27
    suite = loader.suiteClass()
 
28
    import bzrlib._rio_py as py_module
 
29
    scenarios = [('python', {'module': py_module})]
 
30
    if CompiledRioFeature.available():
 
31
        import bzrlib._rio_pyx as c_module
 
32
        scenarios.append(('C', {'module': c_module}))
 
33
    else:
 
34
        # the compiled module isn't available, so we add a failing test
 
35
        class FailWithoutFeature(tests.TestCase):
 
36
            def test_fail(self):
 
37
                self.requireFeature(CompiledRioFeature)
 
38
        suite.addTest(loader.loadTestsFromTestCase(FailWithoutFeature))
 
39
    tests.multiply_tests(standard_tests, scenarios, suite)
28
40
    return suite
29
41
 
30
42
 
 
43
class _CompiledRioFeature(tests.Feature):
 
44
 
 
45
    def _probe(self):
 
46
        try:
 
47
            import bzrlib._rio_pyx
 
48
        except ImportError:
 
49
            return False
 
50
        return True
 
51
 
 
52
    def feature_name(self):
 
53
        return 'bzrlib._rio_pyx'
 
54
 
 
55
CompiledRioFeature = _CompiledRioFeature()
 
56
 
 
57
 
31
58
class TestValidTag(tests.TestCase):
32
59
 
33
60
    module = None # Filled in by test parameterization