[Pkg-bazaar-commits] ./bzr/unstable r843: - workaround for flaky TestLoader in python2.3

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


------------------------------------------------------------
revno: 843
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Wed 2005-07-06 15:24:29 +1000
message:
  - workaround for flaky TestLoader in python2.3
    
    Now we just list all the test classes manually -- a bit of a pain, but does
    mean we can run the simpler tests first.
modified:
  bzrlib/selftest/__init__.py
  bzrlib/selftest/blackbox.py
  bzrlib/selftest/testmerge3.py
  bzrlib/selftest/versioning.py
  bzrlib/selftest/whitebox.py
-------------- next part --------------
=== modified file 'bzrlib/selftest/__init__.py'
--- a/bzrlib/selftest/__init__.py	2005-07-06 04:40:52 +0000
+++ b/bzrlib/selftest/__init__.py	2005-07-06 05:24:29 +0000
@@ -39,22 +39,26 @@
     print
 
     suite = TestSuite()
-    tl = TestLoader()
 
     # should also test bzrlib.merge_core, but they seem to be out of date with
     # the code.
 
-    for m in bzrlib.selftest.whitebox, \
-            bzrlib.selftest.versioning, \
-            bzrlib.selftest.testmerge3:
-        suite.addTest(tl.loadTestsFromModule(m))
-
-    for m in bzrlib.store, bzrlib.inventory, bzrlib.branch, bzrlib.osutils, \
-            bzrlib.commands, \
-            bzrlib.merge3:
+
+    # python2.3's TestLoader() doesn't seem to work well; don't know why
+
+    for m in (bzrlib.store,
+              bzrlib.inventory,
+              bzrlib.branch,
+              bzrlib.osutils, 
+              bzrlib.commands, 
+              bzrlib.merge3):
         suite.addTest(DocTestSuite(m))
 
-    suite.addTest(bzrlib.selftest.blackbox.suite())
+    for cl in (bzrlib.selftest.whitebox.TEST_CLASSES 
+               + bzrlib.selftest.versioning.TEST_CLASSES
+               + bzrlib.selftest.testmerge3.TEST_CLASSES
+               + bzrlib.selftest.blackbox.TEST_CLASSES):
+        suite.addTest(cl())
 
     return run_suite(suite)
 

=== modified file 'bzrlib/selftest/blackbox.py'
--- a/bzrlib/selftest/blackbox.py	2005-06-24 11:15:37 +0000
+++ b/bzrlib/selftest/blackbox.py	2005-07-06 05:24:29 +0000
@@ -365,16 +365,11 @@
 # do it this way rather than just discovering them all because it
 # allows us to test more basic functions first where failures will be
 # easiest to understand.
-
-def suite():
-    from unittest import TestSuite
-    s = TestSuite()
-    s.addTests([TestVersion(),
-                InitBranch(),
-                HelpCommands(),
-                UserIdentity(),
-                InvalidCommands(),
-                RevertCommand(),
-                OldTests(),
-                ])
-    return s
+TEST_CLASSES = [TestVersion,
+                InitBranch,
+                HelpCommands,
+                UserIdentity,
+                InvalidCommands,
+                RevertCommand,
+                OldTests,
+                ]

=== modified file 'bzrlib/selftest/testmerge3.py'
--- a/bzrlib/selftest/testmerge3.py	2005-07-06 00:37:03 +0000
+++ b/bzrlib/selftest/testmerge3.py	2005-07-06 05:24:29 +0000
@@ -342,3 +342,21 @@
         self.log('merge result:')
         self.log(''.join(ml))
         self.assertEquals(ml, MERGED_RESULT)
+
+
+
+TEST_CLASSES = [
+    NoChanges,
+    FrontInsert,
+    NullInsert,
+    NoConflicts,
+    AppendA,
+    AppendB,
+    AppendAgreement,
+    AppendClash,
+    InsertAgreement,
+    InsertClash,
+    ReplaceClash,
+    ReplaceMulti,
+    MergePoem,
+    ]

=== modified file 'bzrlib/selftest/versioning.py'
--- a/bzrlib/selftest/versioning.py	2005-06-22 08:12:49 +0000
+++ b/bzrlib/selftest/versioning.py	2005-07-06 05:24:29 +0000
@@ -64,3 +64,9 @@
                           b.add,
                           'foo/hello')
         
+
+
+TEST_CLASSES = [
+    Mkdir,
+    AddInUnversioned,
+    ]

=== modified file 'bzrlib/selftest/whitebox.py'
--- a/bzrlib/selftest/whitebox.py	2005-07-04 12:22:34 +0000
+++ b/bzrlib/selftest/whitebox.py	2005-07-06 05:24:29 +0000
@@ -201,3 +201,14 @@
         finally:
             os.chdir(savedir)
             shutil.rmtree(dtmp)
+
+
+
+
+TEST_CLASSES = [Unknowns,
+                ValidateRevisionId,
+                PendingMerges,
+                Revert,
+                RenameDirs,
+                BranchPathTestCase,
+                ]



More information about the Pkg-bazaar-commits mailing list