Rev 3340: Fixed as per Ian's review. in file:///v/home/vila/src/bzr/experimental/faster-selftest/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Apr 28 09:57:50 BST 2008


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

------------------------------------------------------------
revno: 3340
revision-id: v.ladeuil+lp at free.fr-20080428085745-bxrf007hjbqfwup5
parent: v.ladeuil+lp at free.fr-20080428075923-01y4bwj484glvqk7
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: cleanup-test-suite-loading
timestamp: Mon 2008-04-28 10:57:45 +0200
message:
  Fixed as per Ian's review.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/doc/__init__.py         __init__.py-20051224020731-eb3eb3ef5b4570df
  bzrlib/doc/api/__init__.py     __init__.py-20051224020744-7b87d590843855bc
  bzrlib/tests/blackbox/__init__.py __init__.py-20051128053524-eba30d8255e08dc3
  bzrlib/tests/branch_implementations/__init__.py __init__.py-20060123013057-b12a52c3f361daf4
  bzrlib/tests/bzrdir_implementations/__init__.py __init__.py-20060131065642-34c39b54f42dd048
  bzrlib/tests/commands/__init__.py __init__.py-20070520095518-ecfl8531fxgjeycj-1
  bzrlib/tests/interrepository_implementations/__init__.py __init__.py-20060220054744-baf49a1f88f17b1a
  bzrlib/tests/intertree_implementations/__init__.py __init__.py-20060724101752-09ysswo1a92uqyoz-3
  bzrlib/tests/interversionedfile_implementations/__init__.py __init__.py-20060302012326-981af525594d02ed
  bzrlib/tests/inventory_implementations/__init__.py __init__.py-20070821044532-olbadbokgv3qv1yd-1
  bzrlib/tests/per_lock/__init__.py __init__.py-20070314201444-u92yjsqrkh2m3qcb-1
  bzrlib/tests/repository_implementations/__init__.py __init__.py-20060131092037-9564957a7d4a841b
  bzrlib/tests/revisionstore_implementations/__init__.py __init__.py-20060303020702-976c4186a0f99edb
  bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
  bzrlib/tests/tree_implementations/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
  bzrlib/tests/workingtree_implementations/__init__.py __init__.py-20060203003124-b2aa5aca21a8bfad
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2008-04-28 07:59:23 +0000
+++ b/NEWS	2008-04-28 08:57:45 +0000
@@ -55,6 +55,11 @@
 
   TESTING:
 
+    * The test suite modules have been modified to define load_tests() instead
+      of test_suite(). That speeds up selective loading (via --load-list)
+      significantly and provides many examples on how to migrate (grep for
+      load_tests).  (Vincent Ladeuil)
+
   INTERNALS:
 
     * Implement xml8 serializer.  (Aaron Bentley)
@@ -327,8 +332,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. All tests modules have been updated and provides many examples
-      (grep for load_tests).
+      function. (a forthcoming patch will provide many examples on how to
+      implement this).
       (Vincent Ladeuil)
 
     * selftest --load-list now does some sanity checks regarding duplicate test

=== modified file 'bzrlib/doc/__init__.py'
--- a/bzrlib/doc/__init__.py	2008-03-30 20:46:44 +0000
+++ b/bzrlib/doc/__init__.py	2008-04-28 08:57:45 +0000
@@ -30,6 +30,7 @@
         'bzrlib.doc.api',
         ]
 
+    # add the tests for the sub modules
     suite.addTests(loader.loadTestsFromModuleNames(testmod_names))
 
     return suite

=== modified file 'bzrlib/doc/api/__init__.py'
--- a/bzrlib/doc/api/__init__.py	2008-03-30 20:46:44 +0000
+++ b/bzrlib/doc/api/__init__.py	2008-04-28 08:57:45 +0000
@@ -39,6 +39,7 @@
         candidates = []
     scripts = [candidate for candidate in candidates
                if candidate.endswith('.txt')]
+    # since this module doesn't define tests, we ignore basic_tests
     suite = doctest.DocFileSuite(*scripts)
     # DocFileCase reduces the test id to the base name of the tested file, we
     # want the module to appears there.

=== modified file 'bzrlib/tests/blackbox/__init__.py'
--- a/bzrlib/tests/blackbox/__init__.py	2008-03-30 21:48:07 +0000
+++ b/bzrlib/tests/blackbox/__init__.py	2008-04-28 08:57:45 +0000
@@ -117,6 +117,7 @@
                      'bzrlib.tests.blackbox.test_versioning',
                      'bzrlib.tests.blackbox.test_whoami',
                      ]
+    # add the tests for the sub modules
     suite.addTests(loader.loadTestsFromModuleNames(testmod_names))
 
     test_encodings = [

=== modified file 'bzrlib/tests/branch_implementations/__init__.py'
--- a/bzrlib/tests/branch_implementations/__init__.py	2008-03-30 21:49:13 +0000
+++ b/bzrlib/tests/branch_implementations/__init__.py	2008-04-28 08:57:45 +0000
@@ -173,6 +173,7 @@
         # by the TestCaseWithTransport.get_readonly_transport method.
         None,
         combinations)
+    # add the tests for the sub modules
     tests.adapt_modules(test_branch_implementations, adapter, loader, result)
 
     adapt_to_smart_server = BranchTestProviderAdapter(

=== modified file 'bzrlib/tests/bzrdir_implementations/__init__.py'
--- a/bzrlib/tests/bzrdir_implementations/__init__.py	2008-04-17 13:46:07 +0000
+++ b/bzrlib/tests/bzrdir_implementations/__init__.py	2008-04-28 08:57:45 +0000
@@ -106,6 +106,7 @@
         # by the TestCaseWithTransport.get_readonly_transport method.
         None,
         formats)
+    # add the tests for the sub modules
     adapt_modules(test_bzrdir_implementations, adapter, loader, result)
 
     # This will always add the tests for smart server transport, regardless of

=== modified file 'bzrlib/tests/commands/__init__.py'
--- a/bzrlib/tests/commands/__init__.py	2008-03-30 21:57:16 +0000
+++ b/bzrlib/tests/commands/__init__.py	2008-04-28 08:57:45 +0000
@@ -42,6 +42,7 @@
         'bzrlib.tests.commands.test_push',
         'bzrlib.tests.commands.test_update',
         ]
-    suite = loader.loadTestsFromModuleNames(testmod_names)
+    # add the tests for the sub modules
+    suite.addTests(loader.loadTestsFromModuleNames(testmod_names))
 
     return suite

=== modified file 'bzrlib/tests/interrepository_implementations/__init__.py'
--- a/bzrlib/tests/interrepository_implementations/__init__.py	2008-03-30 22:02:38 +0000
+++ b/bzrlib/tests/interrepository_implementations/__init__.py	2008-04-28 08:57:45 +0000
@@ -132,5 +132,6 @@
         None,
         InterRepositoryTestProviderAdapter.default_test_list()
         )
+    # add the tests for the sub modules
     adapt_modules(test_interrepository_implementations, adapter, loader, result)
     return result

=== modified file 'bzrlib/tests/intertree_implementations/__init__.py'
--- a/bzrlib/tests/intertree_implementations/__init__.py	2008-04-17 13:46:07 +0000
+++ b/bzrlib/tests/intertree_implementations/__init__.py	2008-04-28 08:57:45 +0000
@@ -118,5 +118,6 @@
         # by the TestCaseWithTransport.get_readonly_transport method.
         None,
         test_intertree_permutations)
+    # add the tests for the sub modules
     adapt_modules(test_intertree_implementations, adapter, loader, result)
     return result

=== modified file 'bzrlib/tests/interversionedfile_implementations/__init__.py'
--- a/bzrlib/tests/interversionedfile_implementations/__init__.py	2008-04-17 13:46:07 +0000
+++ b/bzrlib/tests/interversionedfile_implementations/__init__.py	2008-04-28 08:57:45 +0000
@@ -102,6 +102,7 @@
         None,
         InterVersionedFileTestProviderAdapter.default_test_list()
         )
+    # add the tests for the sub modules
     adapt_modules(test_interversionedfile_implementations,
                   adapter, loader, result)
     return result

=== modified file 'bzrlib/tests/inventory_implementations/__init__.py'
--- a/bzrlib/tests/inventory_implementations/__init__.py	2008-03-31 16:59:19 +0000
+++ b/bzrlib/tests/inventory_implementations/__init__.py	2008-04-28 08:57:45 +0000
@@ -42,6 +42,7 @@
     modules_to_test = [
         'bzrlib.tests.inventory_implementations.basics',
         ]
+    # add the tests for the sub modules
     suite.addTests(multiply_tests_from_modules(modules_to_test,
                                                _inventory_test_scenarios(),
                                                loader))

=== modified file 'bzrlib/tests/per_lock/__init__.py'
--- a/bzrlib/tests/per_lock/__init__.py	2008-03-31 15:13:41 +0000
+++ b/bzrlib/tests/per_lock/__init__.py	2008-04-28 08:57:45 +0000
@@ -73,5 +73,6 @@
         'bzrlib.tests.per_lock.test_temporary_write_lock',
         ]
     adapter = LockTestProviderAdapter(lock._lock_classes)
+    # add the tests for the sub modules
     tests.adapt_modules(test_lock_implementations, adapter, loader, result)
     return result

=== modified file 'bzrlib/tests/repository_implementations/__init__.py'
--- a/bzrlib/tests/repository_implementations/__init__.py	2008-03-31 16:59:19 +0000
+++ b/bzrlib/tests/repository_implementations/__init__.py	2008-04-28 08:57:45 +0000
@@ -883,6 +883,8 @@
     module_name_list = [prefix + module_name
                         for module_name in test_repository_modules]
 
+    # add the tests for the sub modules
+
     # Parameterize repository_implementations test modules by format.
     result.addTests(multiply_tests_from_modules(module_name_list,
                                                 format_scenarios,

=== modified file 'bzrlib/tests/revisionstore_implementations/__init__.py'
--- a/bzrlib/tests/revisionstore_implementations/__init__.py	2008-03-31 15:23:04 +0000
+++ b/bzrlib/tests/revisionstore_implementations/__init__.py	2008-04-28 08:57:45 +0000
@@ -87,5 +87,6 @@
         None,
         RevisionStoreTestProviderAdapter.default_test_list()
         )
+    # add the tests for the sub modules
     adapt_modules(test_revisionstore_implementations, adapter, loader, result)
     return result

=== modified file 'bzrlib/tests/test_transport_implementations.py'
--- a/bzrlib/tests/test_transport_implementations.py	2008-04-01 19:26:48 +0000
+++ b/bzrlib/tests/test_transport_implementations.py	2008-04-28 08:57:45 +0000
@@ -39,7 +39,6 @@
                            FileExists,
                            InvalidURL,
                            LockError,
-                           NoSmartServer,
                            NoSuchFile,
                            NotLocalUrl,
                            PathError,

=== modified file 'bzrlib/tests/tree_implementations/__init__.py'
--- a/bzrlib/tests/tree_implementations/__init__.py	2008-04-17 13:46:07 +0000
+++ b/bzrlib/tests/tree_implementations/__init__.py	2008-04-28 08:57:45 +0000
@@ -359,5 +359,6 @@
         [(format, format._matchingbzrdir) for format in
          WorkingTreeFormat._formats.values() + _legacy_formats])
 
+    # add the tests for the sub modules
     adapt_modules(test_tree_implementations, adapter, loader, result)
     return result

=== modified file 'bzrlib/tests/workingtree_implementations/__init__.py'
--- a/bzrlib/tests/workingtree_implementations/__init__.py	2008-04-17 13:46:07 +0000
+++ b/bzrlib/tests/workingtree_implementations/__init__.py	2008-04-28 08:57:45 +0000
@@ -48,13 +48,13 @@
         self._transport_server = transport_server
         self._transport_readonly_server = transport_readonly_server
         self.scenarios = self.formats_to_scenarios(formats)
-    
+
     def formats_to_scenarios(self, formats):
         """Transform the input formats to a list of scenarios.
 
         :param formats: A list of (workingtree_format, bzrdir_format).
         """
-    
+
         result = []
         for workingtree_format, bzrdir_format in formats:
             result.append(self.create_scenario(workingtree_format,
@@ -134,8 +134,9 @@
         # None here will cause a readonly decorator to be created
         # by the TestCaseWithTransport.get_readonly_transport method.
         None,
-        [(format, format._matchingbzrdir) for format in 
+        [(format, format._matchingbzrdir) for format in
          WorkingTreeFormat._formats.values() + _legacy_formats])
 
+    # add the tests for the sub modules
     adapt_modules(test_workingtree_implementations, adapter, loader, result)
     return result



More information about the bazaar-commits mailing list