/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
622.1.2 by John Arbash Meinel
Add tests of RevisionView that it can handle broken file-info properties.
1
# Copyright (C) 2007, 2008 Jelmer Vernooij <jelmer@samba.org>
140 by Jelmer Vernooij
add framework for tests.
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
632 by Vincent Ladeuil
Upgrade to the new loading tests API.
17
18
def load_tests(basic_tests, module, loader):
173.1.3 by Robert Collins
Add new command 'commit-notify' to listen for commits on dbus and show them via pynotify.
19
    testmod_names = [
633 by Vincent Ladeuil
Reproduce bug #373157 root cause.
20
        'test_annotate_config',
737.1.3 by Curtis Hovey
Added basic tests to verify __eq__ is fixed.
21
        'test_avatarsbox',
278.1.5 by John Arbash Meinel
Starting to flesh out the dialog with actual windows.
22
        'test_commit',
232.1.4 by Adeodato Simó
Add a test for parse_colordiffrc, and fix the function to handle empty lines.
23
        'test_diff',
622.1.2 by John Arbash Meinel
Add tests of RevisionView that it can handle broken file-info properties.
24
        'test_history',
734.1.50 by Curtis Hovey
Added missing tests for BranchTreeModel and CellRendererGraph.
25
        'test_graphcell',
511.5.2 by Jelmer Vernooij
Add simple test for linegraph.
26
        'test_linegraph',
622.1.2 by John Arbash Meinel
Add tests of RevisionView that it can handle broken file-info properties.
27
        'test_revisionview',
734.1.50 by Curtis Hovey
Added missing tests for BranchTreeModel and CellRendererGraph.
28
        'test_treemodel',
173.1.3 by Robert Collins
Add new command 'commit-notify' to listen for commits on dbus and show them via pynotify.
29
        ]
167 by Jelmer Vernooij
Add simple test for tortoise_bzr
30
632 by Vincent Ladeuil
Upgrade to the new loading tests API.
31
    basic_tests.addTest(loader.loadTestsFromModuleNames(
32
            ["%s.%s" % (__name__, tmn) for tmn in testmod_names]))
33
    return basic_tests
771.1.2 by Curtis Hovey
Moved MockMethod to a common module.
34
35
36
class MockMethod():
37
38
    @classmethod
39
    def bind(klass, test_instance, obj, method_name):
40
        original_method = getattr(obj, method_name)
41
        test_instance.addCleanup(setattr, obj, method_name, original_method)
42
        setattr(obj, method_name, klass())
43
44
    def __init__(self):
45
        self.called = False
46
        self.args = None
47
        self.kwargs = None
48
49
    def __call__(self, *args, **kwargs):
50
        self.called = True
51
        self.args = args
52
        self.kwargs = kwargs