/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Vincent Ladeuil
  • Date: 2010-10-15 09:34:33 UTC
  • mfrom: (5447.5.2 config-read)
  • mto: This revision was merged to the branch mainline in revision 5499.
  • Revision ID: v.ladeuil+lp@free.fr-20101015093433-3rtdmpq8pdkc7reg
Merge config-read into config-modify

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
except ImportError:
90
90
    # lsprof not available
91
91
    pass
92
 
from bzrlib.merge import merge_inner
93
92
import bzrlib.merge3
94
93
import bzrlib.plugin
95
 
from bzrlib.smart import client, request, server
 
94
from bzrlib.smart import client, request
96
95
import bzrlib.store
97
96
from bzrlib import symbol_versioning
98
97
from bzrlib.symbol_versioning import (
116
115
from bzrlib.ui import NullProgressView
117
116
from bzrlib.ui.text import TextUIFactory
118
117
import bzrlib.version_info_formats.format_custom
119
 
from bzrlib.workingtree import WorkingTree, WorkingTreeFormat2
120
118
 
121
119
# Mark this python module as being part of the implementation
122
120
# of unittest: this gives us better tracebacks where the last
3353
3351
    return result
3354
3352
 
3355
3353
 
3356
 
class ForwardingResult(unittest.TestResult):
3357
 
 
3358
 
    def __init__(self, target):
3359
 
        unittest.TestResult.__init__(self)
3360
 
        self.result = target
3361
 
 
3362
 
    def startTest(self, test):
3363
 
        self.result.startTest(test)
3364
 
 
3365
 
    def stopTest(self, test):
3366
 
        self.result.stopTest(test)
3367
 
 
3368
 
    def startTestRun(self):
3369
 
        self.result.startTestRun()
3370
 
 
3371
 
    def stopTestRun(self):
3372
 
        self.result.stopTestRun()
3373
 
 
3374
 
    def addSkip(self, test, reason):
3375
 
        self.result.addSkip(test, reason)
3376
 
 
3377
 
    def addSuccess(self, test):
3378
 
        self.result.addSuccess(test)
3379
 
 
3380
 
    def addError(self, test, err):
3381
 
        self.result.addError(test, err)
3382
 
 
3383
 
    def addFailure(self, test, err):
3384
 
        self.result.addFailure(test, err)
3385
 
ForwardingResult = testtools.ExtendedToOriginalDecorator
3386
 
 
3387
 
 
3388
 
class ProfileResult(ForwardingResult):
 
3354
class ProfileResult(testtools.ExtendedToOriginalDecorator):
3389
3355
    """Generate profiling data for all activity between start and success.
3390
3356
    
3391
3357
    The profile data is appended to the test's _benchcalls attribute and can
3403
3369
        # unavoidably fail.
3404
3370
        bzrlib.lsprof.BzrProfiler.profiler_block = 0
3405
3371
        self.profiler.start()
3406
 
        ForwardingResult.startTest(self, test)
 
3372
        testtools.ExtendedToOriginalDecorator.startTest(self, test)
3407
3373
 
3408
3374
    def addSuccess(self, test):
3409
3375
        stats = self.profiler.stop()
3413
3379
            test._benchcalls = []
3414
3380
            calls = test._benchcalls
3415
3381
        calls.append(((test.id(), "", ""), stats))
3416
 
        ForwardingResult.addSuccess(self, test)
 
3382
        testtools.ExtendedToOriginalDecorator.addSuccess(self, test)
3417
3383
 
3418
3384
    def stopTest(self, test):
3419
 
        ForwardingResult.stopTest(self, test)
 
3385
        testtools.ExtendedToOriginalDecorator.stopTest(self, test)
3420
3386
        self.profiler = None
3421
3387
 
3422
3388