Rev 3331: bzrlib.tests.inventory_implementations and in file:///v/home/vila/src/bzr/experimental/faster-selftest/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Mar 31 17:59:25 BST 2008


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

------------------------------------------------------------
revno: 3331
revision-id: v.ladeuil+lp at free.fr-20080331165919-au2pd7n8yug3ls89
parent: v.ladeuil+lp at free.fr-20080331161740-xkq01oxg8s067gfi
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: use-filter-by-module-test-loader
timestamp: Mon 2008-03-31 18:59:19 +0200
message:
  bzrlib.tests.inventory_implementations and
  bzrlib.tests.repository_implementations switched from test_suite() to
  load_tests().
  
  
  * bzrlib/tests/__init__.py:
  (test_suite): bzrlib.tests.inventory_implementations and
  bzrlib.tests.repository_implementations moved from
  packages_to_test to testmod_names. Poor packages_to_test is now
  empty :)
  
  * bzrlib/tests/repository_implementations/__init__.py:
  (load_tests): Preferred to test_suite().
  
  * bzrlib/tests/inventory_implementations/__init__.py:
  (load_tests): Preferred to test_suite().
modified:
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/inventory_implementations/__init__.py __init__.py-20070821044532-olbadbokgv3qv1yd-1
  bzrlib/tests/repository_implementations/__init__.py __init__.py-20060131092037-9564957a7d4a841b
-------------- next part --------------
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2008-03-31 16:17:40 +0000
+++ b/bzrlib/tests/__init__.py	2008-03-31 16:59:19 +0000
@@ -116,11 +116,7 @@
     The packages are not globally imported so that import failures are
     triggered when running selftest, not when importing the command.
     """
-    import bzrlib.tests.inventory_implementations
-    import bzrlib.tests.repository_implementations
     return [
-            bzrlib.tests.inventory_implementations,
-            bzrlib.tests.repository_implementations,
             ]
 
 
@@ -2642,10 +2638,12 @@
                    'bzrlib.tests.branch_implementations',
                    'bzrlib.tests.bzrdir_implementations',
                    'bzrlib.tests.commands',
+                   'bzrlib.tests.inventory_implementations',
                    'bzrlib.tests.interrepository_implementations',
                    'bzrlib.tests.intertree_implementations',
                    'bzrlib.tests.interversionedfile_implementations',
                    'bzrlib.tests.per_lock',
+                   'bzrlib.tests.repository_implementations',
                    'bzrlib.tests.revisionstore_implementations',
                    'bzrlib.tests.test__dirstate_helpers',
                    'bzrlib.tests.test_ancestry',

=== modified file 'bzrlib/tests/inventory_implementations/__init__.py'
--- a/bzrlib/tests/inventory_implementations/__init__.py	2008-01-03 01:21:46 +0000
+++ b/bzrlib/tests/inventory_implementations/__init__.py	2008-03-31 16:59:19 +0000
@@ -33,10 +33,16 @@
     yield ('Inventory', dict(inventory_class=Inventory))
 
 
-def test_suite():
+def load_tests(basic_tests, module, loader):
     """Generate suite containing all parameterized tests"""
+    suite = loader.suiteClass()
+    # add the tests for this module
+    suite.addTests(basic_tests)
+
     modules_to_test = [
-            'bzrlib.tests.inventory_implementations.basics',
-            ]
-    return multiply_tests_from_modules(modules_to_test,
-            _inventory_test_scenarios())
+        'bzrlib.tests.inventory_implementations.basics',
+        ]
+    suite.addTests(multiply_tests_from_modules(modules_to_test,
+                                               _inventory_test_scenarios(),
+                                               loader))
+    return suite

=== modified file 'bzrlib/tests/repository_implementations/__init__.py'
--- a/bzrlib/tests/repository_implementations/__init__.py	2008-01-11 03:54:51 +0000
+++ b/bzrlib/tests/repository_implementations/__init__.py	2008-03-31 16:59:19 +0000
@@ -43,8 +43,6 @@
                           multiply_scenarios,
                           multiply_tests_from_modules,
                           TestScenarioApplier,
-                          TestLoader,
-                          TestSuite,
                           )
 from bzrlib.tests.bzrdir_implementations.test_bzrdir import TestCaseWithBzrDir
 from bzrlib.transport.memory import MemoryServer
@@ -834,7 +832,11 @@
     ]
     
 
-def test_suite():
+def load_tests(basic_tests, module, loader):
+    result = loader.suiteClass()
+    # add the tests for this module
+    result.addTests(basic_tests)
+
     registry = repository.format_registry
     all_formats = [registry.get(k) for k in registry.keys()]
     all_formats.extend(weaverepo._legacy_formats)
@@ -882,7 +884,9 @@
                         for module_name in test_repository_modules]
 
     # Parameterize repository_implementations test modules by format.
-    result = multiply_tests_from_modules(module_name_list, format_scenarios)
+    result.addTests(multiply_tests_from_modules(module_name_list,
+                                                format_scenarios,
+                                                loader))
 
     # test_check_reconcile needs to be parameterized by format *and* by broken
     # repository scenario.
@@ -892,7 +896,6 @@
         format_scenarios, broken_scenarios)
     broken_scenario_applier = TestScenarioApplier()
     broken_scenario_applier.scenarios = broken_scenarios_for_all_formats
-    loader = TestLoader()
     adapt_modules(
         [prefix + 'test_check_reconcile'],
         broken_scenario_applier, loader, result)



More information about the bazaar-commits mailing list