Rev 3318: Add an optional loader parameter needed when deploying the (upcoming) in file:///v/home/vila/src/bzr/experimental/faster-selftest/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Mar 31 18:20:13 BST 2008


At file:///v/home/vila/src/bzr/experimental/faster-selftest/

------------------------------------------------------------
revno: 3318
revision-id: v.ladeuil+lp at free.fr-20080331172008-o31h3ai3qb8vwjx4
parent: v.ladeuil+lp at free.fr-20080331171123-d1aihpfvqnx6u8mp
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: test-suite-refactoring
timestamp: Mon 2008-03-31 19:20:08 +0200
message:
  Add an optional loader parameter needed when deploying the (upcoming)
  FilteredByModuleTestLoader 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:29 +0000
+++ b/bzrlib/tests/__init__.py	2008-03-31 17:20:08 +0000
@@ -2891,7 +2891,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.
@@ -2903,6 +2903,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.
@@ -2924,8 +2926,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