[Python-checkins] r78011 - in python/branches/py3k: Lib/test/test_unittest.py Lib/unittest/loader.py

michael.foord python-checkins at python.org
Sat Feb 6 01:26:13 CET 2010


Author: michael.foord
Date: Sat Feb 6 01:26:13 2010
New Revision: 78011
Log:
Merged revisions 78010 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk
........
 r78010 | michael.foord | 2010年02月06日 00:22:26 +0000 (2010年2月06日) | 1 line
 
 unittest.TestLoader creates a TestSuite before calling load_tests. Issue 7799.
........
Modified:
 python/branches/py3k/ (props changed)
 python/branches/py3k/Lib/test/test_unittest.py
 python/branches/py3k/Lib/unittest/loader.py
Modified: python/branches/py3k/Lib/test/test_unittest.py
==============================================================================
--- python/branches/py3k/Lib/test/test_unittest.py	(original)
+++ python/branches/py3k/Lib/test/test_unittest.py	Sat Feb 6 01:26:13 2010
@@ -272,12 +272,14 @@
 
 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 = []
Modified: python/branches/py3k/Lib/unittest/loader.py
==============================================================================
--- python/branches/py3k/Lib/unittest/loader.py	(original)
+++ python/branches/py3k/Lib/unittest/loader.py	Sat Feb 6 01:26:13 2010
@@ -61,9 +61,10 @@
 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.


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /