~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-02-12 06:24:08 UTC
  • mfrom: (4000.2.4 test-result-registry)
  • Revision ID: pqm@pqm.ubuntu.com-20090212062408-yq0glwncmdzo5uzm
(robertc) Allow plugins to specify test runner classes for
        cmd_selftest. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2487
2487
              list_only=False,
2488
2488
              random_seed=None,
2489
2489
              exclude_pattern=None,
2490
 
              strict=False):
 
2490
              strict=False,
 
2491
              runner_class=None):
 
2492
    """Run a test suite for bzr selftest.
 
2493
 
 
2494
    :param runner_class: The class of runner to use. Must support the
 
2495
        constructor arguments passed by run_suite which are more than standard
 
2496
        python uses.
 
2497
    :return: A boolean indicating success.
 
2498
    """
2491
2499
    TestCase._gather_lsprof_in_benchmarks = lsprof_timed
2492
2500
    if verbose:
2493
2501
        verbosity = 2
2494
2502
    else:
2495
2503
        verbosity = 1
2496
 
    runner = TextTestRunner(stream=sys.stdout,
 
2504
    if runner_class is None:
 
2505
        runner_class = TextTestRunner
 
2506
    runner = runner_class(stream=sys.stdout,
2497
2507
                            descriptions=0,
2498
2508
                            verbosity=verbosity,
2499
2509
                            bench_history=bench_history,
2555
2565
             load_list=None,
2556
2566
             debug_flags=None,
2557
2567
             starting_with=None,
 
2568
             runner_class=None,
2558
2569
             ):
2559
2570
    """Run the whole test suite under the enhanced runner"""
2560
2571
    # XXX: Very ugly way to do this...
2590
2601
                     list_only=list_only,
2591
2602
                     random_seed=random_seed,
2592
2603
                     exclude_pattern=exclude_pattern,
2593
 
                     strict=strict)
 
2604
                     strict=strict,
 
2605
                     runner_class=runner_class,
 
2606
                     )
2594
2607
    finally:
2595
2608
        default_transport = old_transport
2596
2609
        selftest_debug_flags = old_debug_flags