~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

[merge] robertc

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
import unittest
28
28
import time
29
29
 
 
30
import bzrlib.branch
30
31
import bzrlib.commands
 
32
from bzrlib.errors import BzrError
 
33
import bzrlib.inventory
 
34
import bzrlib.merge3
 
35
import bzrlib.osutils
 
36
import bzrlib.osutils as osutils
 
37
import bzrlib.plugin
 
38
import bzrlib.store
31
39
import bzrlib.trace
32
 
import bzrlib.osutils as osutils
33
40
from bzrlib.trace import mutter
34
41
from bzrlib.tests.TestUtil import TestLoader, TestSuite
35
42
from bzrlib.tests.treeshape import build_tree_contents
36
 
from bzrlib.errors import BzrError
37
43
 
38
44
MODULES_TO_TEST = []
39
 
MODULES_TO_DOCTEST = []
40
 
 
 
45
MODULES_TO_DOCTEST = [
 
46
                      bzrlib.branch,
 
47
                      bzrlib.commands,
 
48
                      bzrlib.errors,
 
49
                      bzrlib.inventory,
 
50
                      bzrlib.merge3,
 
51
                      bzrlib.osutils,
 
52
                      bzrlib.store,
 
53
                      ]
 
54
def packages_to_test():
 
55
    import bzrlib.tests.blackbox
 
56
    return [
 
57
            bzrlib.tests.blackbox
 
58
            ]
41
59
 
42
60
 
43
61
class EarlyStoppingTestResultAdapter(object):
527
545
                f.close()
528
546
 
529
547
    def build_tree_contents(self, shape):
530
 
        bzrlib.tests.build_tree_contents(shape)
 
548
        build_tree_contents(shape)
531
549
 
532
550
    def failUnlessExists(self, path):
533
551
        """Fail unless path, which may be abs or relative, exists."""
590
608
 
591
609
def test_suite():
592
610
    """Build and return TestSuite for the whole program."""
593
 
    import bzrlib.store, bzrlib.inventory, bzrlib.branch
594
 
    import bzrlib.osutils, bzrlib.merge3, bzrlib.plugin
595
611
    from doctest import DocTestSuite
596
612
 
597
 
    global MODULES_TO_TEST, MODULES_TO_DOCTEST
 
613
    global MODULES_TO_DOCTEST
598
614
 
599
615
    # FIXME: If these fail to load, e.g. because of a syntax error, the
600
616
    # exception is hidden by unittest.  Sucks.  Should either fix that or
629
645
                   'bzrlib.tests.test_fetch',
630
646
                   'bzrlib.tests.test_whitebox',
631
647
                   'bzrlib.tests.test_store',
632
 
                   'bzrlib.tests.blackbox',
633
 
                   'bzrlib.tests.blackbox.versioning',
634
648
                   'bzrlib.tests.test_sampler',
635
649
                   'bzrlib.tests.test_transactions',
636
650
                   'bzrlib.tests.test_transport',
652
666
                   'bzrlib.tests.test_rio',
653
667
                   ]
654
668
 
655
 
    for m in (bzrlib.store, bzrlib.inventory, bzrlib.branch,
656
 
              bzrlib.osutils, bzrlib.commands, bzrlib.merge3,
657
 
              bzrlib.errors,
658
 
              ):
659
 
        if m not in MODULES_TO_DOCTEST:
660
 
            MODULES_TO_DOCTEST.append(m)
661
 
 
662
669
    TestCase.BZRPATH = os.path.join(os.path.realpath(os.path.dirname(bzrlib.__path__[0])), 'bzr')
663
670
    print '%-30s %s' % ('bzr binary', TestCase.BZRPATH)
664
671
    print
665
672
    suite = TestSuite()
666
673
    suite.addTest(TestLoader().loadTestsFromNames(testmod_names))
 
674
    for package in packages_to_test():
 
675
        suite.addTest(package.test_suite())
667
676
    for m in MODULES_TO_TEST:
668
 
         suite.addTest(TestLoader().loadTestsFromModule(m))
 
677
        suite.addTest(TestLoader().loadTestsFromModule(m))
669
678
    for m in (MODULES_TO_DOCTEST):
670
679
        suite.addTest(DocTestSuite(m))
671
680
    for p in bzrlib.plugin.all_plugins: