Fix some buggy error handling during connection failures
Change-Id: Ibd760f44e807a9444d249c0e75f03f6b7179ce3b
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index 8eea845..e4dbf9d 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -93,6 +93,7 @@
self.Thread = Thread
self.cleanupFlag = False
self.cleanupLock = threading.Lock()
+ self.initiated = False
self.configparser()
verifyOptions(options)
@@ -151,6 +152,7 @@
This method will initialize specified component
'''
global driver_options
+ self.initiated = False
self.log.info("Creating component Handle: "+component)
driver_options = {}
if 'COMPONENTS' in self.componentDictionary[component].keys():
@@ -176,6 +178,7 @@
self.exit()
vars(self)[component] = driverObject
+ self.initiated = True
def run(self):
'''
@@ -353,7 +356,8 @@
try:
if self.cleanupFlag is False: # First thread to run this
self.cleanupFlag = True
- self.logger.testSummary(self)
+ if self.initiated:
+ self.logger.testSummary(self)
for component in self.componentDictionary.keys():
try :
tempObject = vars(self)[component]
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 8a87a49..37d55fe 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -115,15 +115,13 @@
pwd=self.pwd,
home=self.home )
- self.handle.sendline( "cd " + self.home )
- self.handle.expect( "\$" )
-
if self.handle:
+ self.handle.sendline( "cd " + self.home )
+ self.handle.expect( "\$" )
return self.handle
else:
- main.log.info( "NO ONOS HANDLE" )
+ main.log.info( "Failed to create ONOS handle" )
return main.FALSE
-
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
diff --git a/TestON/drivers/component.py b/TestON/drivers/component.py
index f05be55..9199a4e 100644
--- a/TestON/drivers/component.py
+++ b/TestON/drivers/component.py
@@ -45,9 +45,8 @@
return getattr( self.wrapped, name )
except AttributeError as error:
# NOTE: The first time we load a driver module we get this error
- if "'module' object has no attribute '__path__'" in error\
- and self.count == 0:
- self.count += 1
+ if "'module' object has no attribute '__path__'" in error:
+ pass
else:
main.log.error( str(error.__class__) + " " + str(error) )
try: