~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

Merge first-try into propagate-exceptions

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
    TestUtil,
115
115
    treeshape,
116
116
    )
117
 
from bzrlib.tests.http_server import HttpServer
118
 
from bzrlib.tests.TestUtil import (
119
 
                          TestSuite,
120
 
                          TestLoader,
121
 
                          )
122
117
from bzrlib.ui import NullProgressView
123
118
from bzrlib.ui.text import TextUIFactory
124
119
import bzrlib.version_info_formats.format_custom
846
841
        # going away but leak one) but it seems less likely than the actual
847
842
        # false positives (the test see threads going away and does not leak).
848
843
        if leaked_threads > 0:
 
844
            if 'threads' in selftest_debug_flags:
 
845
                print '%s is leaking, active is now %d' % (self.id(), active)
849
846
            TestCase._leaking_threads_tests += 1
850
847
            if TestCase._first_thread_leaker_id is None:
851
848
                TestCase._first_thread_leaker_id = self.id()
2725
2722
    """
2726
2723
 
2727
2724
    def setUp(self):
 
2725
        from bzrlib.tests import http_server
2728
2726
        super(ChrootedTestCase, self).setUp()
2729
2727
        if not self.vfs_transport_factory == memory.MemoryServer:
2730
 
            self.transport_readonly_server = HttpServer
 
2728
            self.transport_readonly_server = http_server.HttpServer
2731
2729
 
2732
2730
 
2733
2731
def condition_id_re(pattern):
3055
3053
    return suite
3056
3054
 
3057
3055
 
3058
 
class TestDecorator(TestSuite):
 
3056
class TestDecorator(TestUtil.TestSuite):
3059
3057
    """A decorator for TestCase/TestSuite objects.
3060
3058
    
3061
3059
    Usually, subclasses should override __iter__(used when flattening test
3064
3062
    """
3065
3063
 
3066
3064
    def __init__(self, suite):
3067
 
        TestSuite.__init__(self)
 
3065
        TestUtil.TestSuite.__init__(self)
3068
3066
        self.addTest(suite)
3069
3067
 
3070
3068
    def countTestCases(self):
3237
3235
 
3238
3236
    test_blocks = partition_tests(suite, concurrency)
3239
3237
    for process_tests in test_blocks:
3240
 
        process_suite = TestSuite()
 
3238
        process_suite = TestUtil.TestSuite()
3241
3239
        process_suite.addTests(process_tests)
3242
3240
        c2pread, c2pwrite = os.pipe()
3243
3241
        pid = os.fork()
3393
3391
#                           rather than failing tests. And no longer raise
3394
3392
#                           LockContention when fctnl locks are not being used
3395
3393
#                           with proper exclusion rules.
 
3394
#   -Ethreads               Will display thread ident at creation/join time to
 
3395
#                           help track thread leaks
3396
3396
selftest_debug_flags = set()
3397
3397
 
3398
3398
 
3981
3981
    ...     bzrlib.tests.test_sampler.DemoTest('test_nothing'),
3982
3982
    ...     [('one', dict(param=1)),
3983
3983
    ...      ('two', dict(param=2))],
3984
 
    ...     TestSuite())
 
3984
    ...     TestUtil.TestSuite())
3985
3985
    >>> tests = list(iter_suite_tests(r))
3986
3986
    >>> len(tests)
3987
3987
    2