~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__rio.py

  • Committer: Martin Pool
  • Date: 2009-09-14 02:30:23 UTC
  • mto: This revision was merged to the branch mainline in revision 4693.
  • Revision ID: mbp@sourcefrog.net-20090914023023-ros0f3ndo04j3bww
Clearer docs about bzr help.  (Thanks to Naoki)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2009 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
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