Rev 3336: Simplify test_suite(). in file:///v/home/vila/src/bzr/experimental/faster-selftest/

Vincent Ladeuil v.ladeuil+lp at free.fr
Tue Apr 1 20:57:51 BST 2008


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

------------------------------------------------------------
revno: 3336
revision-id: v.ladeuil+lp at free.fr-20080401195746-7yiqnxjhxj2j1u34
parent: v.ladeuil+lp at free.fr-20080401193025-k8ef4c1x1x1lx9rf
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: cleanup-test-suite-loading
timestamp: Tue 2008-04-01 21:57:46 +0200
message:
  Simplify test_suite().
  
  * bzrlib/tests/test_selftest.py:
  (TestTestIdList.test_test_suite): Updated to reflect new module
  order in the list.
  
  * bzrlib/tests/__init__.py:
  (packages_to_test): Deleted. The list is empty now.
  (test_suite): Simplified, all tests modules can now be loaded with
  loadTestsFromModuleName.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2008-04-01 09:42:34 +0000
+++ b/NEWS	2008-04-01 19:57:46 +0000
@@ -123,8 +123,8 @@
     * selftest --load-list now uses a new more agressive test loader that will
       avoid loading unneeded modules and building their tests. Plugins can use
       this new loader by defining a load_tests function instead of a test_suite
-      function. (a forthcoming patch will provide many examples on how to
-      implement this).
+      function. All tests modules have been updated and provides many examples
+      (grep for load_tests).
       (Vincent Ladeuil)
 
     * selftest --load-list now does some sanity checks regarding duplicate test

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2008-04-01 19:30:25 +0000
+++ b/bzrlib/tests/__init__.py	2008-04-01 19:57:46 +0000
@@ -110,16 +110,6 @@
 default_transport = LocalURLServer
 
 
-def packages_to_test():
-    """Return a list of packages to test.
-
-    The packages are not globally imported so that import failures are
-    triggered when running selftest, not when importing the command.
-    """
-    return [
-            ]
-
-
 class ExtendedTestResult(unittest._TextTestResult):
     """Accepts, reports and accumulates the results of running tests.
 
@@ -2778,8 +2768,7 @@
                    'bzrlib.tests.tree_implementations',
                    'bzrlib.tests.workingtree_implementations',
                    ]
-    test_transport_implementations = [
-        ]
+
     loader = TestUtil.TestLoader()
 
     if keep_only is None:
@@ -2792,18 +2781,6 @@
     # modules building their suite with loadTestsFromModuleNames
     suite.addTest(loader.loadTestsFromModuleNames(testmod_names))
 
-    # modules adapted for transport implementations
-    from bzrlib.tests.test_transport_implementations import TransportTestProviderAdapter
-    adapter = TransportTestProviderAdapter()
-    adapt_modules(test_transport_implementations, adapter, loader, suite)
-
-    # modules defining their own test_suite()
-    for package in [p for p in packages_to_test()
-                    if (keep_only is None
-                        or id_filter.refers_to(p.__name__))]:
-        pack_suite = package.test_suite()
-        suite.addTest(pack_suite)
-
     modules_to_doctest = [
         'bzrlib',
         'bzrlib.errors',

=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py	2008-03-26 21:44:40 +0000
+++ b/bzrlib/tests/test_selftest.py	2008-04-01 19:57:46 +0000
@@ -1987,13 +1987,12 @@
         # category
         test_list = [
             # testmod_names
+            'bzrlib.tests.blackbox.test_branch.TestBranch.test_branch',
             'bzrlib.tests.test_selftest.TestTestIdList.test_test_suite',
             # transport implementations
             'bzrlib.tests.test_transport_implementations.TransportTests'
             '.test_abspath(LocalURLServer)',
-            # packages_to_test()
-            'bzrlib.tests.blackbox.test_branch.TestBranch.test_branch',
-            # MODULES_TO_DOCTEST
+            # modules_to_doctest
             'bzrlib.timestamp.format_highres_date',
             # plugins can't be tested that way since selftest may be run with
             # --no-plugins



More information about the bazaar-commits mailing list