~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/__init__.py

  • Committer: aaron.bentley at utoronto
  • Date: 2005-08-27 04:42:41 UTC
  • mfrom: (1092.1.43)
  • mto: (1185.3.4)
  • mto: This revision was merged to the branch mainline in revision 1178.
  • Revision ID: aaron.bentley@utoronto.ca-20050827044241-23d676133b9fc981
Merge of robertc@robertcollins.net-20050826013321-52eee1f1da679ee9

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
 
18
 
from testsweet import TestBase, run_suite, InTempDir
 
18
from testsweet import TestCase, run_suite, InTempDir, FunctionalTestCase
19
19
import bzrlib.commands
20
20
import bzrlib.fetch
21
21
import bzrlib.selftest.teststore
28
28
    """bzr-specific test base class"""
29
29
    def run_bzr(self, *args, **kwargs):
30
30
        retcode = kwargs.get('retcode', 0)
31
 
        self.assertEquals(bzrlib.commands.run_bzr(args), retcode)
 
31
        result = self.apply_redirected(None, None, None,
 
32
                                       bzrlib.commands.run_bzr, args)
 
33
        self.assertEquals(result, retcode)
32
34
        
33
35
 
34
 
def selftest(verbose=False):
35
 
    from unittest import TestLoader, TestSuite
 
36
def selftest(verbose=False, pattern=".*"):
 
37
    return run_suite(test_suite(), 'testbzr', verbose=verbose, pattern=pattern)
 
38
 
 
39
 
 
40
def test_suite():
 
41
    from bzrlib.selftest.TestUtil import TestLoader, TestSuite
36
42
    import bzrlib, bzrlib.store, bzrlib.inventory, bzrlib.branch
37
43
    import bzrlib.osutils, bzrlib.commands, bzrlib.merge3, bzrlib.plugin
38
44
    from doctest import DocTestSuite
47
53
    testmod_names = \
48
54
                  ['bzrlib.selftest.whitebox',
49
55
                   'bzrlib.selftest.versioning',
 
56
                   'bzrlib.selftest.testfetch',
50
57
                   'bzrlib.selftest.testinv',
51
58
                   'bzrlib.selftest.testmerge3',
52
59
                   'bzrlib.selftest.testhashcache',
56
63
                   'bzrlib.selftest.testrevisionnamespaces',
57
64
                   'bzrlib.selftest.testbranch',
58
65
                   'bzrlib.selftest.testrevision',
59
 
                   'bzrlib.merge_core',
 
66
                   'bzrlib.selftest.test_merge_core',
 
67
                   'bzrlib.selftest.test_smart_add',
60
68
                   'bzrlib.selftest.testdiff',
61
69
                   'bzrlib.fetch',
62
70
                   'bzrlib.selftest.teststore',
63
71
                   ]
64
72
 
65
 
    # XXX: should also test bzrlib.merge_core, but they seem to be out
66
 
    # of date with the code.
67
 
 
68
73
    for m in (bzrlib.store, bzrlib.inventory, bzrlib.branch,
69
74
              bzrlib.osutils, bzrlib.commands, bzrlib.merge3):
70
75
        if m not in MODULES_TO_DOCTEST:
71
76
            MODULES_TO_DOCTEST.append(m)
72
77
 
73
 
    
74
 
    TestBase.BZRPATH = os.path.join(os.path.realpath(os.path.dirname(bzrlib.__path__[0])), 'bzr')
75
 
    print '%-30s %s' % ('bzr binary', TestBase.BZRPATH)
76
 
 
 
78
    TestCase.BZRPATH = os.path.join(os.path.realpath(os.path.dirname(bzrlib.__path__[0])), 'bzr')
 
79
    print '%-30s %s' % ('bzr binary', TestCase.BZRPATH)
77
80
    print
78
 
 
79
81
    suite = TestSuite()
80
 
 
81
82
    suite.addTest(TestLoader().loadTestsFromNames(testmod_names))
82
 
 
83
83
    for m in MODULES_TO_TEST:
84
84
         suite.addTest(TestLoader().loadTestsFromModule(m))
85
 
 
86
85
    for m in (MODULES_TO_DOCTEST):
87
86
        suite.addTest(DocTestSuite(m))
88
 
 
89
87
    for p in bzrlib.plugin.all_plugins:
90
88
        if hasattr(p, 'test_suite'):
91
89
            suite.addTest(p.test_suite())
92
 
 
93
 
    import bzrlib.merge_core
94
 
    suite.addTest(unittest.makeSuite(bzrlib.merge_core.MergeTest, 'test_'))
95
 
 
96
 
    return run_suite(suite, 'testbzr', verbose=verbose)
97
 
 
98
 
 
 
90
    return suite
99
91