[Python-checkins] python/dist/src/Lib unittest.py,1.35,1.36
jlgijsbers at users.sourceforge.net
jlgijsbers at users.sourceforge.net
Sun Nov 7 16:46:27 CET 2004
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20299
Modified Files:
unittest.py
Log Message:
Patch #1061904 / bug #878275: give a nicer error message when someone
accidentally derives from TestSuite instead of TestCase.
Index: unittest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- unittest.py 28 Aug 2004 15:22:12 -0000 1.35
+++ unittest.py 7 Nov 2004 15:46:25 -0000 1.36
@@ -489,6 +489,8 @@
def loadTestsFromTestCase(self, testCaseClass):
"""Return a suite of all tests cases contained in testCaseClass"""
+ if issubclass(testCaseClass, TestSuite):
+ raise TypeError("Test cases should not be derived from TestSuite. Maybe you meant to derive from TestCase?")
testCaseNames = self.getTestCaseNames(testCaseClass)
if not testCaseNames and hasattr(testCaseClass, 'runTest'):
testCaseNames = ['runTest']
More information about the Python-checkins
mailing list