Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 41647d6

Browse files
author
Michael Foord
committed
Merged revisions 78010 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r78010 | michael.foord | 2010-02-06 00:22:26 +0000 (Sat, 06 Feb 2010) | 1 line unittest.TestLoader creates a TestSuite before calling load_tests. Issue 7799. ........
1 parent b112a41 commit 41647d6

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

Lib/test/test_unittest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,14 @@ def test(self):
272272

273273
load_tests_args = []
274274
def load_tests(loader, tests, pattern):
275+
self.assertIsInstance(tests, unittest.TestSuite)
275276
load_tests_args.extend((loader, tests, pattern))
276277
return tests
277278
m.load_tests = load_tests
278279

279280
loader = unittest.TestLoader()
280281
suite = loader.loadTestsFromModule(m)
282+
self.assertIsInstance(suite, unittest.TestSuite)
281283
self.assertEquals(load_tests_args, [loader, suite, None])
282284

283285
load_tests_args = []

Lib/unittest/loader.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ def loadTestsFromModule(self, module, use_load_tests=True):
6161
tests.append(self.loadTestsFromTestCase(obj))
6262

6363
load_tests = getattr(module, 'load_tests', None)
64+
tests = self.suiteClass(tests)
6465
if use_load_tests and load_tests is not None:
6566
return load_tests(self, tests, None)
66-
return self.suiteClass(tests)
67+
return tests
6768

6869
def loadTestsFromName(self, name, module=None):
6970
"""Return a suite of all tests cases given a string specifier.

0 commit comments

Comments
 (0)