Clean up exception handling in TestON core
- Catch more specific exceptions
- Clearer Style
- Allow CTRL-C to exit the test cleanly whether from the TestON
cli or ruinning as a script
Change-Id: I7f2e8eeba5229f97c87e06b49a585933a61fa4ad
diff --git a/TestON/core/testparser.py b/TestON/core/testparser.py
index 24b1ca2..aab4388 100644
--- a/TestON/core/testparser.py
+++ b/TestON/core/testparser.py
@@ -46,7 +46,7 @@
try :
while not re.match('^\s*(\'\'\')|^\s*(\"\"\")',testFileList[index],0) :
index = index + 1
- except IndexError,e:
+ except IndexError:
print ''
# skip empty lines and single line comments
@@ -58,11 +58,9 @@
index = 0
statementsList = self.statementsList
while index < len(statementsList):
- #print statementsList[index]
m= re.match('def\s+CASE(\d+)',statementsList[index],0)
self.caseBlock = []
if m:
- #print m.group(1)
index = index + 1
try :
while not re.match('\s*def\s+CASE(\d+)',statementsList[index],0) :
@@ -72,11 +70,9 @@
else :
break
index = index - 1
- except IndexError,e:
- #print 'IndexError'
+ except IndexError:
print ''
self.caseCode [str(m.group(1))] = self.caseBlock
- #print "Case CODE "+self.caseCode [str(m.group(1))]
index = index + 1
return self.caseCode
@@ -108,8 +104,7 @@
else :
break
index = index - 1
- except IndexError,e:
- #print 'IndexError'
+ except IndexError:
print ''
stepCode[step] = stepBlock
step = step + 1