Revert "Clean up exception handling in TestON core"
It looks like the test may hang sometimes after it has completed
This reverts commit 1de6c19da7b6265009f1b3401276dee99ed6cac3.
Change-Id: I475f52ae7b72f747af5a5fbd4440fc74f48e4c9e
diff --git a/TestON/bin/cli.py b/TestON/bin/cli.py
index 54d9781..ffe9d67 100755
--- a/TestON/bin/cli.py
+++ b/TestON/bin/cli.py
@@ -93,23 +93,15 @@
mail <mail-id or list of mail-ids seperated by comma>
example 1, to execute the examples specified in the ~/examples diretory.
'''
- try:
- args = args.split()
- options = {}
- options = self.parseArgs(args,options)
- options = dictToObj(options)
- if not testthread:
- test = TestThread(options)
- test.start()
- while test.isAlive:
- test.join(1)
- else :
- print main.TEST+ " test execution paused, please resume that before executing to another test"
- except KeyboardInterrupt, SystemExit:
- print "Interrupt called, Exiting."
- test._Thread__stop()
- main.cleanup()
- main.exit()
+ args = args.split()
+ options = {}
+ options = self.parseArgs(args,options)
+ options = dictToObj(options)
+ if not testthread:
+ test = TestThread(options)
+ test.start()
+ else :
+ print main.TEST+ " test execution paused, please resume that before executing to another test"
def do_resume(self, line):
'''
@@ -165,7 +157,7 @@
else :
try :
dump.pprint(vars(main)[line])
- except KeyError as e:
+ except KeyError,e:
print e
else :
print "There is no paused test "
@@ -269,7 +261,7 @@
options = self.testcasesInRange(index,option,args,options)
else :
options['testname'] = option
- except IndexError as e:
+ except IndexError,e:
print e
return options
@@ -318,11 +310,7 @@
super(CLI, self).cmdloop(intro="")
self.postloop()
except KeyboardInterrupt:
- if testthread:
- testthread.pause()
- else:
- print "KeyboardInterrupt, Exiting."
- sys.exit()
+ testthread.pause()
def do_echo( self, line ):
'''
@@ -349,7 +337,7 @@
'''
try:
exec( line )
- except Exception as e:
+ except Exception, e:
output( str( e ) + '\n' )
def do_interpret(self,line):
@@ -365,7 +353,7 @@
try :
translated_code = ospk.interpret(text=line)
print translated_code
- except AttributeError as e:
+ except AttributeError, e:
print 'Dynamic params are not allowed in single statement translations'
def do_do (self,line):
@@ -379,9 +367,8 @@
try :
translated_code = ospk.interpret(text=line)
eval(translated_code)
- except ( AttributeError, SyntaxError ) as e:
- print 'Dynamic params are not allowed in single statement translations:'
- print e
+ except (AttributeError,SyntaxError), e:
+ print 'Dynamic params are not allowed in single statement translations'
else :
print "Do will translate and execute the openspeak statement for the paused test.\nPlease use interpret to translate the OpenSpeak statement."
@@ -544,8 +531,8 @@
if not self.is_stop :
result = self.test_on.cleanup()
self.is_stop = True
- except KeyboardInterrupt:
- print "Recevied Interrupt, cleaning-up the logs and drivers before exiting"
+ except(KeyboardInterrupt):
+ print "Recevied Interrupt,cleaning-up the logs and drivers before exiting"
result = self.test_on.cleanup()
self.is_stop = True
@@ -555,17 +542,9 @@
'''
Will pause the test.
'''
- if not cli.pause:
- print "Will pause the test's execution, after completion of this step.....\n\n\n\n"
- cli.pause = True
- self._stopevent.set()
- elif cli.pause and self.is_stop:
- print "KeyboardInterrupt, Exiting."
- self.test_on.exit()
- else:
- print "Recevied Interrupt, cleaning-up the logs and drivers before exiting"
- result = self.test_on.cleanup()
- self.is_stop = True
+ print "Will pause the test's execution, after completion of this step.....\n\n\n\n"
+ cli.pause = True
+ self._stopevent.set()
def play(self):
'''