~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-11-08 02:16:17 UTC
  • mfrom: (4780.1.6 419776-subunit)
  • Revision ID: pqm@pqm.ubuntu.com-20091108021617-uqg5jxt2xx7lm4fe
(vila) Make --parallel=fork compatible with --subunit,
        treat skips as success

Show diffs side-by-side

added added

removed removed

Lines of Context:
3250
3250
    concurrency = osutils.local_concurrency()
3251
3251
    result = []
3252
3252
    from subunit import TestProtocolClient, ProtocolTestCase
3253
 
    try:
3254
 
        from subunit.test_results import AutoTimingTestResultDecorator
3255
 
    except ImportError:
3256
 
        AutoTimingTestResultDecorator = lambda x:x
3257
3253
    class TestInOtherProcess(ProtocolTestCase):
3258
3254
        # Should be in subunit, I think. RBC.
3259
3255
        def __init__(self, stream, pid):
3282
3278
                sys.stdin.close()
3283
3279
                sys.stdin = None
3284
3280
                stream = os.fdopen(c2pwrite, 'wb', 1)
3285
 
                subunit_result = AutoTimingTestResultDecorator(
 
3281
                subunit_result = BzrAutoTimingTestResultDecorator(
3286
3282
                    TestProtocolClient(stream))
3287
3283
                process_suite.run(subunit_result)
3288
3284
            finally:
3412
3408
        return value
3413
3409
 
3414
3410
 
 
3411
try:
 
3412
    from subunit.test_results import AutoTimingTestResultDecorator
 
3413
    # Expected failure should be seen as a success not a failure Once subunit
 
3414
    # provide native support for that, BZRTransformingResult and this class
 
3415
    # will become useless.
 
3416
    class BzrAutoTimingTestResultDecorator(AutoTimingTestResultDecorator):
 
3417
 
 
3418
        def addExpectedFailure(self, test, err):
 
3419
            self._before_event()
 
3420
            return self._call_maybe("addExpectedFailure", self._degrade_skip,
 
3421
                                    test, err)
 
3422
except ImportError:
 
3423
    # Let's just define a no-op decorator
 
3424
    BzrAutoTimingTestResultDecorator = lambda x:x
 
3425
 
 
3426
 
3415
3427
class ProfileResult(ForwardingResult):
3416
3428
    """Generate profiling data for all activity between start and success.
3417
3429
    
4392
4404
# Only define SubUnitBzrRunner if subunit is available.
4393
4405
try:
4394
4406
    from subunit import TestProtocolClient
4395
 
    try:
4396
 
        from subunit.test_results import AutoTimingTestResultDecorator
4397
 
    except ImportError:
4398
 
        AutoTimingTestResultDecorator = lambda x:x
4399
4407
    class SubUnitBzrRunner(TextTestRunner):
4400
4408
        def run(self, test):
4401
 
            result = AutoTimingTestResultDecorator(
 
4409
            result = BzrAutoTimingTestResultDecorator(
4402
4410
                TestProtocolClient(self.stream))
4403
4411
            test.run(result)
4404
4412
            return result