/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/selftest/__init__.py

  • Committer: aaron.bentley at utoronto
  • Date: 2005-09-03 22:41:50 UTC
  • mto: (1185.3.4)
  • mto: This revision was merged to the branch mainline in revision 1178.
  • Revision ID: aaron.bentley@utoronto.ca-20050903224149-ceb3c2df52071fe4
Caused remotebranch to throw a NoSuchRevision when appropriate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2005 by Canonical Ltd
 
2
 
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
 
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
 
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
 
 
17
 
 
18
from testsweet import TestCase, run_suite, InTempDir, FunctionalTestCase
 
19
import bzrlib.commands
 
20
import bzrlib.fetch
 
21
import bzrlib.selftest.teststore
 
22
 
 
23
MODULES_TO_TEST = []
 
24
MODULES_TO_DOCTEST = []
 
25
 
 
26
 
 
27
class BzrTestBase(InTempDir):
 
28
    """bzr-specific test base class"""
 
29
    def run_bzr(self, *args, **kwargs):
 
30
        retcode = kwargs.get('retcode', 0)
 
31
        result = self.apply_redirected(None, None, None,
 
32
                                       bzrlib.commands.run_bzr, args)
 
33
        self.assertEquals(result, retcode)
 
34
        
 
35
 
 
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
 
42
    import bzrlib, bzrlib.store, bzrlib.inventory, bzrlib.branch
 
43
    import bzrlib.osutils, bzrlib.commands, bzrlib.merge3, bzrlib.plugin
 
44
    from doctest import DocTestSuite
 
45
    import os
 
46
    import shutil
 
47
    import time
 
48
    import sys
 
49
    import unittest
 
50
 
 
51
    global MODULES_TO_TEST, MODULES_TO_DOCTEST
 
52
 
 
53
    testmod_names = \
 
54
                  ['bzrlib.selftest.whitebox',
 
55
                   'bzrlib.selftest.versioning',
 
56
                   'bzrlib.selftest.testfetch',
 
57
                   'bzrlib.selftest.testinv',
 
58
                   'bzrlib.selftest.testmerge3',
 
59
                   'bzrlib.selftest.testhashcache',
 
60
                   'bzrlib.selftest.teststatus',
 
61
                   'bzrlib.selftest.testlog',
 
62
                   'bzrlib.selftest.blackbox',
 
63
                   'bzrlib.selftest.testrevisionnamespaces',
 
64
                   'bzrlib.selftest.testbranch',
 
65
                   'bzrlib.selftest.testrevision',
 
66
                   'bzrlib.selftest.test_merge_core',
 
67
                   'bzrlib.selftest.test_smart_add',
 
68
                   'bzrlib.selftest.testdiff',
 
69
                   'bzrlib.fetch',
 
70
                   'bzrlib.selftest.teststore',
 
71
                   ]
 
72
 
 
73
    for m in (bzrlib.store, bzrlib.inventory, bzrlib.branch,
 
74
              bzrlib.osutils, bzrlib.commands, bzrlib.merge3):
 
75
        if m not in MODULES_TO_DOCTEST:
 
76
            MODULES_TO_DOCTEST.append(m)
 
77
 
 
78
    TestCase.BZRPATH = os.path.join(os.path.realpath(os.path.dirname(bzrlib.__path__[0])), 'bzr')
 
79
    print '%-30s %s' % ('bzr binary', TestCase.BZRPATH)
 
80
    print
 
81
    suite = TestSuite()
 
82
    suite.addTest(TestLoader().loadTestsFromNames(testmod_names))
 
83
    for m in MODULES_TO_TEST:
 
84
         suite.addTest(TestLoader().loadTestsFromModule(m))
 
85
    for m in (MODULES_TO_DOCTEST):
 
86
        suite.addTest(DocTestSuite(m))
 
87
    for p in bzrlib.plugin.all_plugins:
 
88
        if hasattr(p, 'test_suite'):
 
89
            suite.addTest(p.test_suite())
 
90
    return suite
 
91