63
63
visitor.visitSuite(test)
64
64
visitTests(test, visitor)
66
print("unvisitable non-unittest.TestCase element %r (%r)" % (
67
test, test.__class__))
66
print "unvisitable non-unittest.TestCase element %r (%r)" % (
70
70
class FailedCollectionCase(unittest.TestCase):
105
105
count_stored_tests = getattr(result, "_count_stored_tests", int)
106
from breezy.tests import selftest_debug_flags
106
from bzrlib.tests import selftest_debug_flags
107
107
notify = "uncollected_cases" in selftest_debug_flags
109
109
if result.shouldStop:
155
155
result.addTests(self.loadTestsFromModule(module))
158
def loadTestsFromModule(self, module):
159
"""Load tests from a module object.
161
This extension of the python test loader looks for an attribute
162
load_tests in the module object, and if not found falls back to the
163
regular python loadTestsFromModule.
165
If a load_tests attribute is found, it is called and the result is
168
load_tests should be defined like so:
169
>>> def load_tests(standard_tests, module, loader):
172
standard_tests is the tests found by the stock TestLoader in the
173
module, module and loader are the module and loader instances.
175
For instance, to run every test twice, you might do:
176
>>> def load_tests(standard_tests, module, loader):
177
>>> result = loader.suiteClass()
178
>>> for test in iter_suite_tests(standard_tests):
179
>>> result.addTests([test, test])
182
if sys.version_info < (2, 7):
183
basic_tests = super(TestLoader, self).loadTestsFromModule(module)
185
# GZ 2010-07-19: Python 2.7 unittest also uses load_tests but with
186
# a different and incompatible signature
187
basic_tests = super(TestLoader, self).loadTestsFromModule(module,
188
use_load_tests=False)
189
load_tests = getattr(module, "load_tests", None)
190
if load_tests is not None:
191
return load_tests(basic_tests, module, self)
158
195
def getTestCaseNames(self, test_case_class):
159
196
test_fn_names = self.test_func_names.get(test_case_class, None)
160
197
if test_fn_names is not None: