I'm having trouble preventing Unittest from calling sys.exit(). I found Unittest causing sys.exit() searching for an answer.I modified the code to
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromTestCase(run_tests.Compare))
and put it in my main. I believe the only thing I changed is that my test is in a seperate file named run_tests.py. It looks as such
import unittest
from list_of_globals import globvar
value1 = globvar.relerror
value2 = globvar.tolerance
class Compare(unittest.TestCase):
def __init__(self,value1,value2):
super(Compare, self).__init__()
self.value1 = value1
self.value2 = value2
def runTest(self):
self.assertTrue(self.value1 < self.value2)
When I run my main function I receive the following error
File "./main.py", line 44, in <module> unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromTestCase(run_tests.Compare))
File "/usr/lib64/python2.6/unittest.py", line 550, in loadTestsFromTestCase
return self.suiteClass(map(testCaseClass, testCaseNames))
TypeError: __init__() takes exactly 3 arguments (2 given)
I don't understand why this error occurs or how to go about fixing it. Any help would be much appreciated. I am using python 2.6 on linux