~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/TestUtil.py

  • Committer: Danny van Heumen
  • Date: 2010-03-09 21:42:11 UTC
  • mto: (4634.139.5 2.0)
  • mto: This revision was merged to the branch mainline in revision 5160.
  • Revision ID: danny@dannyvanheumen.nl-20100309214211-iqh42x6qcikgd9p3
Reverted now-useless TODO list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2004, 2005, 2006 Canonical Ltd
2
2
#       Author: Robert Collins <robert.collins@canonical.com>
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
72
72
        visitor.visitSuite(self)
73
73
        visitTests(self, visitor)
74
74
 
75
 
    def run(self, result):
76
 
        """Run the tests in the suite, discarding references after running."""
77
 
        tests = list(self)
78
 
        tests.reverse()
79
 
        self._tests = []
80
 
        while tests:
81
 
            if result.shouldStop:
82
 
                self._tests = reversed(tests)
83
 
                break
84
 
            tests.pop().run(result)
85
 
        return result
86
 
 
87
75
 
88
76
class TestLoader(unittest.TestLoader):
89
77
    """Custom TestLoader to extend the stock python one."""
135
123
        >>>         result.addTests([test, test])
136
124
        >>>     return result
137
125
        """
138
 
        if sys.version_info < (2, 7):
139
 
            basic_tests = super(TestLoader, self).loadTestsFromModule(module)
140
 
        else:
141
 
            # GZ 2010-07-19: Python 2.7 unittest also uses load_tests but with
142
 
            #                a different and incompatible signature
143
 
            basic_tests = super(TestLoader, self).loadTestsFromModule(module,
144
 
                use_load_tests=False)
 
126
        basic_tests = super(TestLoader, self).loadTestsFromModule(module)
145
127
        load_tests = getattr(module, "load_tests", None)
146
128
        if load_tests is not None:
147
129
            return load_tests(basic_tests, module, self)