[Pkg-bazaar-commits] ./bzr/unstable r983: - clean up code that loads modules to test, taking advantage of less broken

Martin Pool mbp at sourcefrog.net
Fri Apr 10 08:21:40 UTC 2009


------------------------------------------------------------
revno: 983
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Wed 2005-07-27 11:19:23 -0300
message:
  - clean up code that loads modules to test, taking advantage of less broken
    testLoader in python 2.4
modified:
  bzrlib/selftest/__init__.py
-------------- next part --------------
=== modified file 'bzrlib/selftest/__init__.py'
--- a/bzrlib/selftest/__init__.py	2005-07-25 19:25:12 +0000
+++ b/bzrlib/selftest/__init__.py	2005-07-27 14:19:23 +0000
@@ -33,18 +33,6 @@
     from unittest import TestLoader, TestSuite
     import bzrlib, bzrlib.store, bzrlib.inventory, bzrlib.branch
     import bzrlib.osutils, bzrlib.commands, bzrlib.merge3, bzrlib.plugin
-    global MODULES_TO_TEST, MODULES_TO_DOCTEST
-
-    import bzrlib.selftest.whitebox
-    import bzrlib.selftest.blackbox
-    import bzrlib.selftest.versioning
-    import bzrlib.selftest.testmerge3
-    import bzrlib.selftest.testhashcache
-    import bzrlib.selftest.testrevisionnamespaces
-    import bzrlib.selftest.testbranch
-    import bzrlib.selftest.teststatus
-    import bzrlib.selftest.testinv
-    import bzrlib.merge_core
     from doctest import DocTestSuite
     import os
     import shutil
@@ -52,27 +40,29 @@
     import sys
     import unittest
 
+    global MODULES_TO_TEST, MODULES_TO_DOCTEST
+
+    testmod_names = \
+                  ['bzrlib.selftest.whitebox',
+                   'bzrlib.selftest.versioning',
+                   'bzrlib.selftest.testinv',
+                   'bzrlib.selftest.testmerge3',
+                   'bzrlib.selftest.testhashcache',
+                   'bzrlib.selftest.teststatus',
+                   'bzrlib.selftest.blackbox',
+                   'bzrlib.selftest.testrevisionnamespaces',
+                   'bzrlib.selftest.testbranch',
+                   ]
+
+    # XXX: should also test bzrlib.merge_core, but they seem to be out
+    # of date with the code.
+
     for m in (bzrlib.store, bzrlib.inventory, bzrlib.branch,
               bzrlib.osutils, bzrlib.commands, bzrlib.merge3):
         if m not in MODULES_TO_DOCTEST:
             MODULES_TO_DOCTEST.append(m)
+
     
-    # ugly ugly!
-    for m in (bzrlib.selftest.whitebox,
-              bzrlib.selftest.versioning,
-              bzrlib.selftest.testinv,
-              bzrlib.selftest.testmerge3,
-              bzrlib.selftest.testhashcache,
-              bzrlib.selftest.teststatus,
-              bzrlib.selftest.blackbox,
-              bzrlib.selftest.testhashcache,
-              bzrlib.selftest.testrevisionnamespaces,
-              bzrlib.selftest.testbranch,
-              ):
-        if m not in MODULES_TO_TEST:
-            MODULES_TO_TEST.append(m)
-
-
     TestBase.BZRPATH = os.path.join(os.path.realpath(os.path.dirname(bzrlib.__path__[0])), 'bzr')
     print '%-30s %s' % ('bzr binary', TestBase.BZRPATH)
 
@@ -80,12 +70,8 @@
 
     suite = TestSuite()
 
-    # should also test bzrlib.merge_core, but they seem to be out of date with
-    # the code.
-
-
-    # XXX: python2.3's TestLoader() doesn't seem to find all the
-    # tests; don't know why
+    suite.addTest(TestLoader().loadTestsFromNames(testmod_names))
+
     for m in MODULES_TO_TEST:
          suite.addTest(TestLoader().loadTestsFromModule(m))
 
@@ -96,6 +82,7 @@
         if hasattr(p, 'test_suite'):
             suite.addTest(p.test_suite())
 
+    import bzrlib.merge_core
     suite.addTest(unittest.makeSuite(bzrlib.merge_core.MergeTest, 'test_'))
 
     return run_suite(suite, 'testbzr', verbose=verbose)



More information about the Pkg-bazaar-commits mailing list