/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__static_tuple.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-12-22 18:18:20 UTC
  • mfrom: (4913.2.26 2.1.0rc1-module-available)
  • Revision ID: pqm@pqm.ubuntu.com-20091222181820-qfolh2sy2nevoxxj
(jam) Switch many test features over to ModuleAvailable.

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
32
32
 
33
33
def load_tests(standard_tests, module, loader):
34
34
    """Parameterize tests for all versions of groupcompress."""
35
 
    global compiled_static_tuple_feature
36
 
    suite, compiled_static_tuple_feature = tests.permute_tests_for_extension(
37
 
        standard_tests, loader, 'bzrlib._static_tuple_py',
38
 
        'bzrlib._static_tuple_c')
39
 
    return suite
 
35
    scenarios = [
 
36
        ('python', {'module': _static_tuple_py}),
 
37
    ]
 
38
    suite = loader.suiteClass()
 
39
    if compiled_static_tuple_feature.available():
 
40
        scenarios.append(('C', {'module':
 
41
                                compiled_static_tuple_feature.module}))
 
42
    else:
 
43
        # the compiled module isn't available, so we add a failing test
 
44
        class FailWithoutFeature(tests.TestCase):
 
45
            def test_fail(self):
 
46
                self.requireFeature(compiled_static_tuple_feature)
 
47
        suite.addTest(loader.loadTestsFromTestCase(FailWithoutFeature))
 
48
    result = tests.multiply_tests(standard_tests, scenarios, suite)
 
49
    return result
 
50
 
 
51
 
 
52
compiled_static_tuple_feature = tests.ModuleAvailableFeature(
 
53
                                    'bzrlib._static_tuple_c')
40
54
 
41
55
 
42
56
class _Meliae(tests.Feature):
77
91
    def test_create_bad_args(self):
78
92
        args_256 = ['a']*256
79
93
        # too many args
80
 
        self.assertRaises(TypeError, self.module.StaticTuple, *args_256)
 
94
        self.assertRaises(ValueError, self.module.StaticTuple, *args_256)
81
95
        args_300 = ['a']*300
82
 
        self.assertRaises(TypeError, self.module.StaticTuple, *args_300)
 
96
        self.assertRaises(ValueError, self.module.StaticTuple, *args_300)
83
97
        # not a string
84
98
        self.assertRaises(TypeError, self.module.StaticTuple, object())
85
99