~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-07-23 04:46:26 UTC
  • mfrom: (4557.2.1 subunit-times)
  • Revision ID: pqm@pqm.ubuntu.com-20090723044626-jyq6o3zy6ru11v0f
(robertc) Support timestamping subunit streams. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2973
2973
    concurrency = osutils.local_concurrency()
2974
2974
    result = []
2975
2975
    from subunit import TestProtocolClient, ProtocolTestCase
 
2976
    try:
 
2977
        from subunit.test_results import AutoTimingTestResultDecorator
 
2978
    except ImportError:
 
2979
        AutoTimingTestResultDecorator = lambda x:x
2976
2980
    class TestInOtherProcess(ProtocolTestCase):
2977
2981
        # Should be in subunit, I think. RBC.
2978
2982
        def __init__(self, stream, pid):
3001
3005
                sys.stdin.close()
3002
3006
                sys.stdin = None
3003
3007
                stream = os.fdopen(c2pwrite, 'wb', 1)
3004
 
                subunit_result = TestProtocolClient(stream)
 
3008
                subunit_result = AutoTimingTestResultDecorator(
 
3009
                    TestProtocolClient(stream))
3005
3010
                process_suite.run(subunit_result)
3006
3011
            finally:
3007
3012
                os._exit(0)
3995
4000
# Only define SubUnitBzrRunner if subunit is available.
3996
4001
try:
3997
4002
    from subunit import TestProtocolClient
 
4003
    try:
 
4004
        from subunit.test_results import AutoTimingTestResultDecorator
 
4005
    except ImportError:
 
4006
        AutoTimingTestResultDecorator = lambda x:x
3998
4007
    class SubUnitBzrRunner(TextTestRunner):
3999
4008
        def run(self, test):
4000
 
            result = TestProtocolClient(self.stream)
 
4009
            result = AutoTimingTestResultDecorator(
 
4010
                TestProtocolClient(self.stream))
4001
4011
            test.run(result)
4002
4012
            return result
4003
4013
except ImportError: