15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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)
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)
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
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',
66
'bzrlib.selftest.test_merge_core',
67
'bzrlib.selftest.test_smart_add',
60
68
'bzrlib.selftest.testdiff',
62
70
'bzrlib.selftest.teststore',
65
# XXX: should also test bzrlib.merge_core, but they seem to be out
66
# of date with the code.
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)
74
TestBase.BZRPATH = os.path.join(os.path.realpath(os.path.dirname(bzrlib.__path__[0])), 'bzr')
75
print '%-30s %s' % ('bzr binary', TestBase.BZRPATH)
78
TestCase.BZRPATH = os.path.join(os.path.realpath(os.path.dirname(bzrlib.__path__[0])), 'bzr')
79
print '%-30s %s' % ('bzr binary', TestCase.BZRPATH)
79
81
suite = TestSuite()
81
82
suite.addTest(TestLoader().loadTestsFromNames(testmod_names))
83
83
for m in MODULES_TO_TEST:
84
84
suite.addTest(TestLoader().loadTestsFromModule(m))
86
85
for m in (MODULES_TO_DOCTEST):
87
86
suite.addTest(DocTestSuite(m))
89
87
for p in bzrlib.plugin.all_plugins:
90
88
if hasattr(p, 'test_suite'):
91
89
suite.addTest(p.test_suite())
93
import bzrlib.merge_core
94
suite.addTest(unittest.makeSuite(bzrlib.merge_core.MergeTest, 'test_'))
96
return run_suite(suite, 'testbzr', verbose=verbose)