Hello,
I have a Python script and I am trying to set a variable so that if the first test fail's the rest of then will be set to fail. The script I have so far is:
class Tests(unittest.TestCase):
def result(self):
....This function does something[ignore]......
someArg = 0
def testPass(self):
try:
self.result()
except suds.WebFault, e:
assert False
except Exception, e:
pass
finally:
if someArg == 0:
assert True
else:
global error
error = False
assert False
def testFail(self):
try:
self.result()
except suds.WebFault, e:
assert False
except Exception, e:
pass
finally:
if someArg == 0 or 'error' in globals():
assert False
else:
assert True
class Get(Tests):
def runTest(self):
self.testPass()
class GetFail(Tests):
def runTest(self):
self.errorHandle()
self.testFail()
if __name__ == '__main__':
unittest.main()
I am trying to get self.error to be set to False if the first test fail. I understand that it is being set in another test but I was hoping someone could help me find a solution to this problem using some other means.
Thanks
PS. Please ignore the strange tests. There is a problem with the error handling at the moment.