~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/__init__.py

  • Committer: Martin Pool
  • Date: 2005-07-27 14:19:23 UTC
  • Revision ID: mbp@sourcefrog.net-20050727141923-9f4f14835da8a2db
- clean up code that loads modules to test, taking advantage of less broken
  testLoader in python 2.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    from unittest import TestLoader, TestSuite
34
34
    import bzrlib, bzrlib.store, bzrlib.inventory, bzrlib.branch
35
35
    import bzrlib.osutils, bzrlib.commands, bzrlib.merge3, bzrlib.plugin
36
 
    global MODULES_TO_TEST, MODULES_TO_DOCTEST
37
 
 
38
 
    import bzrlib.selftest.whitebox
39
 
    import bzrlib.selftest.blackbox
40
 
    import bzrlib.selftest.versioning
41
 
    import bzrlib.selftest.testmerge3
42
 
    import bzrlib.selftest.testhashcache
43
 
    import bzrlib.selftest.testrevisionnamespaces
44
 
    import bzrlib.selftest.testbranch
45
 
    import bzrlib.selftest.teststatus
46
 
    import bzrlib.selftest.testinv
47
 
    import bzrlib.merge_core
48
36
    from doctest import DocTestSuite
49
37
    import os
50
38
    import shutil
52
40
    import sys
53
41
    import unittest
54
42
 
 
43
    global MODULES_TO_TEST, MODULES_TO_DOCTEST
 
44
 
 
45
    testmod_names = \
 
46
                  ['bzrlib.selftest.whitebox',
 
47
                   'bzrlib.selftest.versioning',
 
48
                   'bzrlib.selftest.testinv',
 
49
                   'bzrlib.selftest.testmerge3',
 
50
                   'bzrlib.selftest.testhashcache',
 
51
                   'bzrlib.selftest.teststatus',
 
52
                   'bzrlib.selftest.blackbox',
 
53
                   'bzrlib.selftest.testrevisionnamespaces',
 
54
                   'bzrlib.selftest.testbranch',
 
55
                   ]
 
56
 
 
57
    # XXX: should also test bzrlib.merge_core, but they seem to be out
 
58
    # of date with the code.
 
59
 
55
60
    for m in (bzrlib.store, bzrlib.inventory, bzrlib.branch,
56
61
              bzrlib.osutils, bzrlib.commands, bzrlib.merge3):
57
62
        if m not in MODULES_TO_DOCTEST:
58
63
            MODULES_TO_DOCTEST.append(m)
 
64
 
59
65
    
60
 
    # ugly ugly!
61
 
    for m in (bzrlib.selftest.whitebox,
62
 
              bzrlib.selftest.versioning,
63
 
              bzrlib.selftest.testinv,
64
 
              bzrlib.selftest.testmerge3,
65
 
              bzrlib.selftest.testhashcache,
66
 
              bzrlib.selftest.teststatus,
67
 
              bzrlib.selftest.blackbox,
68
 
              bzrlib.selftest.testhashcache,
69
 
              bzrlib.selftest.testrevisionnamespaces,
70
 
              bzrlib.selftest.testbranch,
71
 
              ):
72
 
        if m not in MODULES_TO_TEST:
73
 
            MODULES_TO_TEST.append(m)
74
 
 
75
 
 
76
66
    TestBase.BZRPATH = os.path.join(os.path.realpath(os.path.dirname(bzrlib.__path__[0])), 'bzr')
77
67
    print '%-30s %s' % ('bzr binary', TestBase.BZRPATH)
78
68
 
80
70
 
81
71
    suite = TestSuite()
82
72
 
83
 
    # should also test bzrlib.merge_core, but they seem to be out of date with
84
 
    # the code.
85
 
 
86
 
 
87
 
    # XXX: python2.3's TestLoader() doesn't seem to find all the
88
 
    # tests; don't know why
 
73
    suite.addTest(TestLoader().loadTestsFromNames(testmod_names))
 
74
 
89
75
    for m in MODULES_TO_TEST:
90
76
         suite.addTest(TestLoader().loadTestsFromModule(m))
91
77
 
96
82
        if hasattr(p, 'test_suite'):
97
83
            suite.addTest(p.test_suite())
98
84
 
 
85
    import bzrlib.merge_core
99
86
    suite.addTest(unittest.makeSuite(bzrlib.merge_core.MergeTest, 'test_'))
100
87
 
101
88
    return run_suite(suite, 'testbzr', verbose=verbose)