~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: mbp at sourcefrog
  • Date: 2005-03-22 00:18:39 UTC
  • Revision ID: mbp@sourcefrog.net-20050322001839-54b231febd06340d
bzr selftest shows some counts of tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
480
480
    print bzrlib.branch._gen_revision_id(time.time())
481
481
 
482
482
 
483
 
def cmd_doctest():
484
 
    """Run internal doctest suite"""
 
483
def cmd_selftest(verbose=False):
 
484
    """Run internal test suite"""
485
485
    ## -v, if present, is seen by doctest; the argument is just here
486
486
    ## so our parser doesn't complain
487
487
 
488
488
    ## TODO: --verbose option
 
489
 
 
490
    failures, tests = 0, 0
489
491
    
490
 
    import doctest, bzrlib.store
 
492
    import doctest, bzrlib.store, bzrlib.tests
491
493
    bzrlib.trace.verbose = False
492
 
    doctest.testmod(bzrlib.store)
493
 
    doctest.testmod(bzrlib.inventory)
494
 
    doctest.testmod(bzrlib.branch)
495
 
    doctest.testmod(bzrlib.osutils)
496
 
    doctest.testmod(bzrlib.tree)
497
 
 
498
 
    # more strenuous tests;
499
 
    import bzrlib.tests
500
 
    doctest.testmod(bzrlib.tests)
501
 
 
502
 
 
503
 
cmd_selftest = cmd_doctest
 
494
 
 
495
    for m in bzrlib.store, bzrlib.inventory, bzrlib.branch, bzrlib.osutils, \
 
496
        bzrlib.tree, bzrlib.tests:
 
497
        mf, mt = doctest.testmod(m)
 
498
        failures += mf
 
499
        tests += mt
 
500
        print '%-40s %3d tests' % (m.__name__, mt),
 
501
        if mf:
 
502
            print '%3d FAILED!' % mf
 
503
        else:
 
504
            print
 
505
 
 
506
    print '%-40s %3d tests' % ('total', tests),
 
507
    if failures:
 
508
        print '%3d FAILED!' % failures
 
509
    else:
 
510
        print
 
511
 
 
512
 
 
513
 
 
514
# deprecated
 
515
cmd_doctest = cmd_selftest
504
516
 
505
517
 
506
518
######################################################################