Hi All,
See below small example. I am trying to have one constructor for a class
with unittest inherited. But with any of the permutation combination I am
getting the error.
Any idea for reason behind this??
import unittest2
class XMLSupport(unittest2.TestCase):
def __init__(self):
*unittest2.TestCase.__init__(self)
#with or without this line we get the error*
self.x = 3
def test_3(self):
print (self.x)
self.x += 1
def test_4(self):
print (self.x)
Traceback (most recent call last):
File "testMain.py", line 212, in <module>
main()
File "testMain.py", line 164, in main
suites=unittest2.defaultTestLoader.discover(stdir, pattern)
File
"c:\Python26\lib\site-packages\unittest2-0.5.1-py2.6.egg\unittest2\loader
.py", line 224, in discover
tests = list(self._find_tests(start_dir, pattern))
File
"c:\Python26\lib\site-packages\unittest2-0.5.1-py2.6.egg\unittest2\loader
.py", line 274, in _find_tests
yield self.loadTestsFromModule(module)
File
"c:\Python26\lib\site-packages\unittest2-0.5.1-py2.6.egg\unittest2\loader
.py", line 85, in loadTestsFromModule
tests.append(self.loadTestsFromTestCase(obj))
File
"c:\Python26\lib\site-packages\unittest2-0.5.1-py2.6.egg\unittest2\loader
.py", line 76, in loadTestsFromTestCase
loaded_suite = self.suiteClass(map(testCaseClass, testCaseNames))
*TypeError: __init__() takes exactly 1 argument (2 given)*
--
Nitin K
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers