diff options
author | Johannes Gijsbers <jlg@dds.nl> | 2004-11-07 15:46:25 (GMT) |
---|---|---|
committer | Johannes Gijsbers <jlg@dds.nl> | 2004-11-07 15:46:25 (GMT) |
commit | d7b6ad4b600fb8c89683d6efa6b350d5d47a5700 (patch) | |
tree | 1798ee40147a198494127dfeab71bb0fbd380f75 | |
parent | c1d6536d60c39475895fb8691f81510393b9737b (diff) | |
download | cpython-d7b6ad4b600fb8c89683d6efa6b350d5d47a5700.zip cpython-d7b6ad4b600fb8c89683d6efa6b350d5d47a5700.tar.gz cpython-d7b6ad4b600fb8c89683d6efa6b350d5d47a5700.tar.bz2 |
Patch #1061904 / bug #878275: give a nicer error message when someone
accidentally derives from TestSuite instead of TestCase.
-rw-r--r-- | Lib/unittest.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/unittest.py b/Lib/unittest.py index 3375067..70645fb 100644 --- a/Lib/unittest.py +++ b/Lib/unittest.py @@ -489,6 +489,8 @@ class TestLoader: 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'] |