]> granicus.if.org Git - python/commitdiff
Merged revisions 78010 via svnmerge from
authorMichael Foord <fuzzyman@voidspace.org.uk>
Sat, 6 Feb 2010 00:26:13 +0000 (00:26 +0000)
committerMichael Foord <fuzzyman@voidspace.org.uk>
Sat, 6 Feb 2010 00:26:13 +0000 (00:26 +0000)
svn+ssh://pythondev@svn.python.org/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.
........

Lib/test/test_unittest.py
Lib/unittest/loader.py

index 73b32754f000e3b98e73844745e38ab6a90ff456..e58c6b763bcb9e53e85019d3445d9eeddb5bb1d2 100644 (file)
@@ -272,12 +272,14 @@ class Test_TestLoader(TestCase):
 
         load_tests_args = []
         def load_tests(loader, tests, pattern):
+            self.assertIsInstance(tests, unittest.TestSuite)
             load_tests_args.extend((loader, tests, pattern))
             return tests
         m.load_tests = load_tests
 
         loader = unittest.TestLoader()
         suite = loader.loadTestsFromModule(m)
+        self.assertIsInstance(suite, unittest.TestSuite)
         self.assertEquals(load_tests_args, [loader, suite, None])
 
         load_tests_args = []
index 68f954cde0bc8914783e4f5cb0ef4f62f2c8a7b4..bfee3dcc4117b17ab6db972942ae7ef4245b5de3 100644 (file)
@@ -61,9 +61,10 @@ class TestLoader(object):
                 tests.append(self.loadTestsFromTestCase(obj))
 
         load_tests = getattr(module, 'load_tests', None)
+        tests = self.suiteClass(tests)
         if use_load_tests and load_tests is not None:
             return load_tests(self, tests, None)
-        return self.suiteClass(tests)
+        return tests
 
     def loadTestsFromName(self, name, module=None):
         """Return a suite of all tests cases given a string specifier.