[Pyunit-interest] __init__() breaks TestCase subclass
Brought to you by:
purcell
From: Ng P. S. <ng...@po...> - 2000-11-18 17:25:18
|
Hi, I've seem to have run into a bug: /usr/local/home/ngps/prog/pyunit:$ ./test.py Traceback (most recent call last): File "./test.py", line 31, in ? unittest.TextTestRunner().run(suite()) File "./test.py", line 27, in suite return unittest.makeSuite(aClassTestCase, 'check') File "/usr/local/lib/python2.0/site-packages/unittest.py", line 391, in makeSuite getTestCaseNames(testCaseClass, prefix, sortUsing)) TypeError: too many arguments; expected 1, got 2 My test case subclass has an __init__(). If I remove it then all is fine. /usr/local/home/ngps/prog/pyunit:$ cat test.py #!/usr/bin/env python import unittest class aClass: def __init__(self, qn, ans): self.qn = qn self.ans = ans class aClassTestCase(unittest.TestCase): def __init__(self): unittest.TestCase.__init__(self) self.x = 'x' def setUp(self): self.obj = aClass('the meaning of life', 42) def tearDown(self): pass def check_something(self): assert self.obj.ans == 42 def suite(): return unittest.makeSuite(aClassTestCase, 'check') if __name__ == '__main__': unittest.TextTestRunner().run(suite()) Hints on getting around this appreciated. Cheers. -- Ng Pheng Siong <ng...@po...> * http://www.post1.com/home/ngps |