[Pkg-bazaar-commits] ./bzr/unstable r55: bzr selftest shows some counts of tests

mbp at sourcefrog.net mbp at sourcefrog.net
Fri Apr 10 07:26:50 UTC 2009


------------------------------------------------------------
revno: 55
committer: mbp at sourcefrog.net
timestamp: Tue 2005-03-22 11:18:39 +1100
message:
  bzr selftest shows some counts of tests
modified:
  bzrlib/commands.py
-------------- next part --------------
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2005-03-21 22:39:52 +0000
+++ b/bzrlib/commands.py	2005-03-22 00:18:39 +0000
@@ -480,27 +480,39 @@
     print bzrlib.branch._gen_revision_id(time.time())
 
 
-def cmd_doctest():
-    """Run internal doctest suite"""
+def cmd_selftest(verbose=False):
+    """Run internal test suite"""
     ## -v, if present, is seen by doctest; the argument is just here
     ## so our parser doesn't complain
 
     ## TODO: --verbose option
+
+    failures, tests = 0, 0
     
-    import doctest, bzrlib.store
+    import doctest, bzrlib.store, bzrlib.tests
     bzrlib.trace.verbose = False
-    doctest.testmod(bzrlib.store)
-    doctest.testmod(bzrlib.inventory)
-    doctest.testmod(bzrlib.branch)
-    doctest.testmod(bzrlib.osutils)
-    doctest.testmod(bzrlib.tree)
-
-    # more strenuous tests;
-    import bzrlib.tests
-    doctest.testmod(bzrlib.tests)
-
-
-cmd_selftest = cmd_doctest
+
+    for m in bzrlib.store, bzrlib.inventory, bzrlib.branch, bzrlib.osutils, \
+        bzrlib.tree, bzrlib.tests:
+        mf, mt = doctest.testmod(m)
+        failures += mf
+        tests += mt
+        print '%-40s %3d tests' % (m.__name__, mt),
+        if mf:
+            print '%3d FAILED!' % mf
+        else:
+            print
+
+    print '%-40s %3d tests' % ('total', tests),
+    if failures:
+        print '%3d FAILED!' % failures
+    else:
+        print
+
+
+
+# deprecated
+cmd_doctest = cmd_selftest
 
 
 ######################################################################



More information about the Pkg-bazaar-commits mailing list