import unittest
class TestTemplate(unittest.TestCase):
@classmethod
def setUpClass(self):
self.result = 'error'
print "setUpClass"
@classmethod
def tearDownClass(self):
print "The value of result is, ",self.result
if self.result == 'ok':
print "it is working"
print "The value of cls result is : ", self.result
print "TearDownClass"
class MyTest(TestTemplate):
def test_method_one(self):
self.result = 'ok'
print self.result
if __name__ == '__main__':
unittest.main()
In the tearDownClass the value of self.result is error, but rather it should be okay because I changed it in the method? Is there any resolve to this?