/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to tests/__init__.py

  • Committer: Daniel Schierbeck
  • Date: 2008-01-13 14:12:49 UTC
  • mto: (423.1.2 trunk)
  • mto: This revision was merged to the branch mainline in revision 429.
  • Revision ID: daniel.schierbeck@gmail.com-20080113141249-gd0i2lknr3yik55r
Moved branch view to its own package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2008 Jelmer Vernooij <jelmer@samba.org>
 
1
# Copyright (C) 2007 Jelmer Vernooij <jelmer@samba.org>
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
 
18
 
def load_tests(basic_tests, module, loader):
 
17
from unittest import TestLoader, TestSuite
 
18
from bzrlib.tests import TestUtil
 
19
 
 
20
import os
 
21
 
 
22
def test_suite():
 
23
    result = TestSuite()
 
24
 
 
25
    loader = TestUtil.TestLoader()
 
26
 
19
27
    testmod_names = [
20
 
        'test_annotate_config',
21
 
        'test_avatarsbox',
22
28
        'test_commit',
23
29
        'test_diff',
 
30
        'test_preferences',
24
31
        'test_history',
25
 
        'test_graphcell',
26
 
        'test_linegraph',
27
 
        'test_notify',
28
 
        'test_revisionview',
29
 
        'test_treemodel',
30
32
        ]
31
33
 
32
 
    basic_tests.addTest(loader.loadTestsFromModuleNames(
33
 
            ["%s.%s" % (__name__, tmn) for tmn in testmod_names]))
34
 
    return basic_tests
35
 
 
36
 
 
37
 
class MockMethod():
38
 
 
39
 
    @classmethod
40
 
    def bind(klass, test_instance, obj, method_name):
41
 
        original_method = getattr(obj, method_name)
42
 
        test_instance.addCleanup(setattr, obj, method_name, original_method)
43
 
        setattr(obj, method_name, klass())
44
 
 
45
 
    def __init__(self):
46
 
        self.called = False
47
 
        self.args = None
48
 
        self.kwargs = None
49
 
 
50
 
    def __call__(self, *args, **kwargs):
51
 
        self.called = True
52
 
        self.args = args
53
 
        self.kwargs = kwargs
 
34
    if os.name == 'nt':
 
35
        testmod_names.append("test_tortoise_bzr")
 
36
 
 
37
    result.addTest(loader.loadTestsFromModuleNames(["%s.%s" % (__name__, i) for i in testmod_names]))
 
38
    return result
 
39