Rev 3324: Add an optional loader parameter needed when deploying the test in file:///v/home/vila/src/bzr/experimental/faster-selftest/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Mon Mar 31 17:17:08 BST 2008
At file:///v/home/vila/src/bzr/experimental/faster-selftest/
------------------------------------------------------------
revno: 3324
revision-id: v.ladeuil+lp at free.fr-20080331161703-0ueczeko01f5bf2v
parent: v.ladeuil+lp at free.fr-20080330202852-doh9ipbxw6zewnc7
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: filter-by-module-test-loader
timestamp: Mon 2008-03-31 18:17:03 +0200
message:
Add an optional loader parameter needed when deploying the test
loader for parametrized inventory_implementations and
repository_implementations tests.
* bzrlib/tests/__init__.py:
(multiply_tests_from_modules): Add an optional loader parameter.
modified:
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
-------------- next part --------------
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2008-03-30 20:28:52 +0000
+++ b/bzrlib/tests/__init__.py 2008-03-31 16:17:03 +0000
@@ -2878,7 +2878,7 @@
return suite
-def multiply_tests_from_modules(module_name_list, scenario_iter):
+def multiply_tests_from_modules(module_name_list, scenario_iter, loader=None):
"""Adapt all tests in some given modules to given scenarios.
This is the recommended public interface for test parameterization.
@@ -2890,6 +2890,8 @@
modules.
:param scenario_iter: Iterable of pairs of (scenario_name,
scenario_param_dict).
+ :param loader: If provided, will be used instead of a new
+ bzrlib.tests.TestLoader() instance.
This returns a new TestSuite containing the cross product of
all the tests in all the modules, each repeated for each scenario.
@@ -2911,8 +2913,13 @@
>>> tests[1].param
2
"""
- loader = TestLoader()
- suite = TestSuite()
+ # XXX: Isn't load_tests() a better way to provide the same functionality
+ # without forcing a predefined TestScenarioApplier ? --vila 080215
+ if loader is None:
+ loader = TestUtil.TestLoader()
+
+ suite = loader.suiteClass()
+
adapter = TestScenarioApplier()
adapter.scenarios = list(scenario_iter)
adapt_modules(module_name_list, adapter, loader, suite)
More information about the bazaar-commits
mailing list