[ python-Bugs-878275 ] Handle: class MyTest(unittest.TestSuite)
SourceForge.net
noreply at sourceforge.net
Tue Aug 17 04:34:59 CEST 2004
Bugs item #878275, was opened at 2004-01-16 09:22
Message generated for change (Settings changed) made by rhettinger
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=878275&group_id=5470
Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
>Priority: 6
Submitted By: Raymond Hettinger (rhettinger)
Assigned to: Steve Purcell (purcell)
Summary: Handle: class MyTest(unittest.TestSuite)
Initial Comment:
TestCases are supposed to be derived from
unittest.TestCase; however, if they are derived from
unittest.TestSuite, the traceback is inexplicable and
hard to diagnose:
Traceback (most recent call last):
File "C:/pydev/tmp.py", line 10, in -toplevel-
unittest.TextTestRunner(verbosity=2).run(suite)
File "C:\PY24\lib\unittest.py", line 690, in run
test(result)
File "C:\PY24\lib\unittest.py", line 423, in __call__
test(result)
File "C:\PY24\lib\unittest.py", line 423, in __call__
test(result)
File "C:\PY24\lib\unittest.py", line 423, in __call__
test(result)
TypeError: 'str' object is not callable
Let's either improve the error message or make it
possible to derive from TestSuite.
The above traceback is produced by the following script:
import unittest
class TestStats(unittest.TestSuite):
def testtwo(self):
self.assertEqual(2,2)
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestStats))
unittest.TextTestRunner(verbosity=2).run(suite)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=878275&group_id=5470
More information about the Python-bugs-list
mailing list