~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Robert Collins
  • Date: 2009-08-26 23:30:48 UTC
  • mto: This revision was merged to the branch mainline in revision 4659.
  • Revision ID: robertc@robertcollins.net-20090826233048-4yerdwqhvi2dqzi9
Detangle test listing: its more part of the ui layer not the execute-this-test-layer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
608
608
                 descriptions=0,
609
609
                 verbosity=1,
610
610
                 bench_history=None,
611
 
                 list_only=False,
612
611
                 strict=False,
613
612
                 result_decorators=None,
614
613
                 ):
623
622
        self.descriptions = descriptions
624
623
        self.verbosity = verbosity
625
624
        self._bench_history = bench_history
626
 
        self.list_only = list_only
627
625
        self._strict = strict
628
626
        self._result_decorators = result_decorators or []
629
627
 
630
628
    def run(self, test):
631
629
        "Run the given test case or test suite."
632
 
        if self.list_only:
633
 
            if self.verbosity >= 2:
634
 
                self.stream.writeln("Listing tests only ...\n")
635
 
            run = 0
636
 
            for t in iter_suite_tests(test):
637
 
                self.stream.writeln("%s" % (t.id()))
638
 
                run += 1
639
 
            return None
640
630
        if self.verbosity == 1:
641
631
            result_class = TextTestResult
642
632
        elif self.verbosity >= 2:
2804
2794
                            descriptions=0,
2805
2795
                            verbosity=verbosity,
2806
2796
                            bench_history=bench_history,
2807
 
                            list_only=list_only,
2808
2797
                            strict=strict,
2809
2798
                            result_decorators=result_decorators,
2810
2799
                            )
2827
2816
        decorators.append(CountingDecorator)
2828
2817
    for decorator in decorators:
2829
2818
        suite = decorator(suite)
2830
 
    result = runner.run(suite)
2831
2819
    if list_only:
 
2820
        # Done after test suite decoration to allow randomisation etc
 
2821
        # to take effect, though that is of marginal benefit.
 
2822
        if verbosity >= 2:
 
2823
            stream.write("Listing tests only ...\n")
 
2824
        for t in iter_suite_tests(suite):
 
2825
            stream.write("%s\n" % (t.id()))
2832
2826
        return True
 
2827
    result = runner.run(suite)
2833
2828
    if strict:
2834
2829
        return result.wasStrictlySuccessful()
2835
2830
    else: