Rev 3321: DocTests can now be filtered at module level too. in file:///v/home/vila/src/bzr/experimental/faster-selftest/

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Mar 26 21:37:11 GMT 2008


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

------------------------------------------------------------
revno: 3321
revision-id: v.ladeuil+lp at free.fr-20080326213706-ekg9wg715ynpq16n
parent: v.ladeuil+lp at free.fr-20080326121905-8smldtdh74skxa1i
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: filter-by-module-test-loader
timestamp: Wed 2008-03-26 22:37:06 +0100
message:
  DocTests can now be filtered at module level too.
  
  * bzrlib/tests/__init__.py:
  (MODULES_TO_DOCTEST): Moved to test_suite().
  (test_suite): DocTestSuite is perfectly happy with a module name.
modified:
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
-------------- next part --------------
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2008-03-26 12:19:05 +0000
+++ b/bzrlib/tests/__init__.py	2008-03-26 21:37:06 +0000
@@ -109,22 +109,6 @@
 
 default_transport = LocalURLServer
 
-MODULES_TO_DOCTEST = [
-        bzrlib,
-        bzrlib.timestamp,
-        bzrlib.errors,
-        bzrlib.export,
-        bzrlib.inventory,
-        bzrlib.iterablefile,
-        bzrlib.lockdir,
-        bzrlib.merge3,
-        bzrlib.option,
-        bzrlib.store,
-        bzrlib.version_info_formats.format_custom,
-        # quoted to avoid module-loading circularity
-        'bzrlib.tests',
-        ]
-
 
 def packages_to_test():
     """Return a list of packages to test.
@@ -2818,10 +2802,25 @@
         pack_suite = package.test_suite()
         suite.addTest(pack_suite)
 
-    for mod in MODULES_TO_DOCTEST:
-        # FIXME: Can't filter on 'mod' since it can be either a module or its
-        # name.
+    modules_to_doctest = [
+        'bzrlib',
+        'bzrlib.errors',
+        'bzrlib.export',
+        'bzrlib.inventory',
+        'bzrlib.iterablefile',
+        'bzrlib.lockdir',
+        'bzrlib.merge3',
+        'bzrlib.option',
+        'bzrlib.store',
+        'bzrlib.tests',
+        'bzrlib.timestamp',
+        'bzrlib.version_info_formats.format_custom',
+        ]
 
+    for mod in modules_to_doctest:
+        if not (keep_only is None or id_filter.refers_to(mod)):
+            # No tests to keep here, move along
+            continue
         try:
             doc_suite = doctest.DocTestSuite(mod)
         except ValueError, e:



More information about the bazaar-commits mailing list