~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__rio.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) 2009 Canonical Ltd
 
1
# Copyright (C) 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
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