/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/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-04-01 09:18:48 UTC
  • mfrom: (3323.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20080401091848-6y4f104r061ad8bk
(vila) Slight test suite refactorings

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
 
110
110
default_transport = LocalURLServer
111
111
 
112
 
MODULES_TO_TEST = []
113
112
MODULES_TO_DOCTEST = [
114
113
        bzrlib,
115
114
        bzrlib.timestamp,
2849
2848
            pack_suite = filter_suite_by_id_list(pack_suite, id_filter)
2850
2849
        suite.addTest(pack_suite)
2851
2850
 
2852
 
    # XXX: MODULES_TO_TEST should be obsoleted ?
2853
 
    for mod in [m for m in MODULES_TO_TEST
2854
 
                if keep_only is None or id_filter.is_module_name_used(m)]:
2855
 
        mod_suite = loader.loadTestsFromModule(mod)
2856
 
        if keep_only is not None:
2857
 
            mod_suite = filter_suite_by_id_list(mod_suite, id_filter)
2858
 
        suite.addTest(mod_suite)
2859
 
 
2860
2851
    for mod in MODULES_TO_DOCTEST:
2861
2852
        try:
2862
2853
            doc_suite = doctest.DocTestSuite(mod)
2900
2891
    return suite
2901
2892
 
2902
2893
 
2903
 
def multiply_tests_from_modules(module_name_list, scenario_iter):
 
2894
def multiply_tests_from_modules(module_name_list, scenario_iter, loader=None):
2904
2895
    """Adapt all tests in some given modules to given scenarios.
2905
2896
 
2906
2897
    This is the recommended public interface for test parameterization.
2912
2903
        modules.
2913
2904
    :param scenario_iter: Iterable of pairs of (scenario_name, 
2914
2905
        scenario_param_dict).
 
2906
    :param loader: If provided, will be used instead of a new 
 
2907
        bzrlib.tests.TestLoader() instance.
2915
2908
 
2916
2909
    This returns a new TestSuite containing the cross product of
2917
2910
    all the tests in all the modules, each repeated for each scenario.
2933
2926
    >>> tests[1].param
2934
2927
    2
2935
2928
    """
2936
 
    loader = TestLoader()
2937
 
    suite = TestSuite()
 
2929
    # XXX: Isn't load_tests() a better way to provide the same functionality
 
2930
    # without forcing a predefined TestScenarioApplier ? --vila 080215
 
2931
    if loader is None:
 
2932
        loader = TestUtil.TestLoader()
 
2933
 
 
2934
    suite = loader.suiteClass()
 
2935
 
2938
2936
    adapter = TestScenarioApplier()
2939
2937
    adapter.scenarios = list(scenario_iter)
2940
2938
    adapt_modules(module_name_list, adapter, loader, suite)