~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2006-06-18 02:21:57 UTC
  • mfrom: (1787 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1794.
  • Revision ID: john@arbash-meinel.com-20060618022157-6e33aa9b67c25e4f
[merge] bzr.dev 1787

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
import codecs
30
30
from cStringIO import StringIO
31
31
import difflib
32
 
import doctest
33
32
import errno
34
33
import logging
35
34
import os
70
69
from bzrlib.transport.local import LocalRelpathServer
71
70
from bzrlib.transport.readonly import ReadonlyServer
72
71
from bzrlib.trace import mutter
73
 
from bzrlib.tests import TestUtil
74
 
from bzrlib.tests.TestUtil import (
75
 
                          TestSuite,
76
 
                          TestLoader,
77
 
                          )
 
72
from bzrlib.tests.TestUtil import TestLoader, TestSuite
78
73
from bzrlib.tests.treeshape import build_tree_contents
79
74
import bzrlib.urlutils as urlutils
80
75
from bzrlib.workingtree import WorkingTree, WorkingTreeFormat2
339
334
                # If LANG=C we probably have created some bogus paths
340
335
                # which rmtree(unicode) will fail to delete
341
336
                # so make sure we are using rmtree(str) to delete everything
342
 
                # except on win32, where rmtree(str) will fail
343
 
                # since it doesn't have the property of byte-stream paths
344
 
                # (they are either ascii or mbcs)
345
 
                if sys.platform == 'win32':
346
 
                    # make sure we are using the unicode win32 api
347
 
                    test_root = unicode(test_root)
348
 
                else:
349
 
                    test_root = test_root.encode(
350
 
                        sys.getfilesystemencoding())
351
 
                osutils.rmtree(test_root)
 
337
                osutils.rmtree(test_root.encode(
 
338
                    sys.getfilesystemencoding()))
352
339
        else:
353
340
            if self.pb is not None:
354
341
                self.pb.note("Failed tests working directories are in '%s'\n",
689
676
        self.log('run bzr: %r', argv)
690
677
        # FIXME: don't call into logging here
691
678
        handler = logging.StreamHandler(stderr)
 
679
        handler.setFormatter(bzrlib.trace.QuietFormatter())
692
680
        handler.setLevel(logging.INFO)
693
681
        logger = logging.getLogger('')
694
682
        logger.addHandler(handler)
1141
1129
 
1142
1130
 
1143
1131
def filter_suite_by_re(suite, pattern):
1144
 
    result = TestUtil.TestSuite()
 
1132
    result = TestSuite()
1145
1133
    filter_re = re.compile(pattern)
1146
1134
    for test in iter_suite_tests(suite):
1147
1135
        if filter_re.search(test.id()):
1202
1190
    This function can be replaced if you need to change the default test
1203
1191
    suite on a global basis, but it is not encouraged.
1204
1192
    """
1205
 
    testmod_names = [
 
1193
    from doctest import DocTestSuite
 
1194
 
 
1195
    global MODULES_TO_DOCTEST
 
1196
 
 
1197
    testmod_names = [ \
1206
1198
                   'bzrlib.tests.test_ancestry',
1207
1199
                   'bzrlib.tests.test_api',
1208
1200
                   'bzrlib.tests.test_bad_files',
1282
1274
        'bzrlib.tests.test_transport_implementations',
1283
1275
        'bzrlib.tests.test_read_bundle',
1284
1276
        ]
1285
 
    suite = TestUtil.TestSuite()
 
1277
 
 
1278
    suite = TestSuite()
1286
1279
    loader = TestUtil.TestLoader()
1287
1280
    from bzrlib.transport import TransportTestProviderAdapter
1288
1281
    adapter = TransportTestProviderAdapter()
1292
1285
        suite.addTest(package.test_suite())
1293
1286
    for m in MODULES_TO_TEST:
1294
1287
        suite.addTest(loader.loadTestsFromModule(m))
1295
 
    for m in MODULES_TO_DOCTEST:
1296
 
        suite.addTest(doctest.DocTestSuite(m))
 
1288
    for m in (MODULES_TO_DOCTEST):
 
1289
        suite.addTest(DocTestSuite(m))
1297
1290
    for name, plugin in bzrlib.plugin.all_plugins().items():
1298
1291
        if getattr(plugin, 'test_suite', None) is not None:
1299
1292
            suite.addTest(plugin.test_suite())