~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__rio.py

  • Committer: Andrew Bennetts
  • Date: 2010-01-15 03:58:20 UTC
  • mfrom: (4963 +trunk)
  • mto: (4973.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4975.
  • Revision ID: andrew.bennetts@canonical.com-20100115035820-ilb3t36swgzq6v1l
MergeĀ lp:bzr.

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
 
    # 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)
 
26
    suite, _ = tests.permute_tests_for_extension(standard_tests, loader,
 
27
        'bzrlib._rio_py', 'bzrlib._rio_pyx')
40
28
    return suite
41
29
 
42
30
 
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
 
 
58
31
class TestValidTag(tests.TestCase):
59
32
 
60
33
    module = None # Filled in by test parameterization