/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: John Arbash Meinel
  • Date: 2007-10-02 17:33:27 UTC
  • mto: (322.1.1 trunk) (330.3.3 trunk)
  • mto: This revision was merged to the branch mainline in revision 368.
  • Revision ID: john@arbash-meinel.com-20071002173327-3td5w3r03q4thu5j
Add a test-gtk command to make testing faster

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
visualise         Graphically visualise this branch. 
32
32
"""
33
33
 
 
34
import sys
 
35
 
34
36
import bzrlib
35
37
 
36
38
version_info = (0, 92, 0, 'dev', 0)
607
609
register_command(cmd_gselftest)
608
610
 
609
611
 
 
612
class cmd_test_gtk(GTKCommand):
 
613
    """Version of selftest that just runs the gtk test suite."""
 
614
 
 
615
    takes_options = ['verbose',
 
616
                     Option('one', short_name='1',
 
617
                            help='stop when one test fails'),
 
618
                     Option('benchmark', help='run the benchmarks.'),
 
619
                     Option('lsprof-timed',
 
620
                     help='generate lsprof output for benchmarked'
 
621
                          ' sections of code.'),
 
622
                     Option('list-only',
 
623
                     help='list the tests instead of running them'),
 
624
                     Option('randomize', type=str, argname="SEED",
 
625
                     help='randomize the order of tests using the given'
 
626
                          ' seed or "now" for the current time'),
 
627
                    ]
 
628
    takes_args = ['testspecs*']
 
629
 
 
630
    def run(self, verbose=None, one=False, benchmark=None,
 
631
            lsprof_timed=None, list_only=False, randomize=None,
 
632
            testspecs_list=None):
 
633
        from bzrlib import __path__ as bzrlib_path
 
634
        from bzrlib.tests import selftest
 
635
 
 
636
        print '%10s: %s' % ('bzrlib', bzrlib_path[0])
 
637
        if benchmark:
 
638
            print 'No benchmarks yet'
 
639
            return 3
 
640
 
 
641
            test_suite_factory = bench_suite
 
642
            if verbose is None:
 
643
                verbose = True
 
644
            # TODO: should possibly lock the history file...
 
645
            benchfile = open(".perf_history", "at", buffering=1)
 
646
        else:
 
647
            test_suite_factory = test_suite
 
648
            if verbose is None:
 
649
                verbose = False
 
650
            benchfile = None
 
651
 
 
652
        if testspecs_list is not None:
 
653
            pattern = '|'.join(testspecs_list)
 
654
        else:
 
655
            pattern = ".*"
 
656
 
 
657
        try:
 
658
            result = selftest(verbose=verbose,
 
659
                              pattern=pattern,
 
660
                              stop_on_failure=one,
 
661
                              test_suite_factory=test_suite_factory,
 
662
                              lsprof_timed=lsprof_timed,
 
663
                              bench_history=benchfile,
 
664
                              list_only=list_only,
 
665
                              random_seed=randomize,
 
666
                             )
 
667
        finally:
 
668
            if benchfile is not None:
 
669
                benchfile.close()
 
670
 
 
671
register_command(cmd_test_gtk)
 
672
 
 
673
 
610
674
import gettext
611
675
gettext.install('olive-gtk')
612
676