Use threading in HA Sanity Test and add Thread to TestON core
Conflicts:
TestON/core/teston.py
TestON/tests/HATestSanity/HATestSanity.py
TestON/tests/OnosCHO/ThreadingOnos.py
TestON/tests/PingallExample/PingallExample.params
diff --git a/TestON/core/Thread.py b/TestON/core/Thread.py
index e20abc3..452437a 100644
--- a/TestON/core/Thread.py
+++ b/TestON/core/Thread.py
@@ -1,9 +1,11 @@
#!/usr/bin/env python
import threading
-class Thread(threading.Thread):
- def __init__(self, target = None, threadID=None, name="", args=(), kwargs={}):
- super(Thread, self).__init__()
+
+class Thread( threading.Thread ):
+ def __init__( self, target=None, threadID=None, name="", args=(),
+ kwargs={} ):
+ super( Thread, self ).__init__()
self.threadID = threadID
self.name = name
self.target = target
@@ -14,11 +16,16 @@
def run( self ):
try:
if self.target is not None:
+ self.result = self.target( *self.args, **self.kwargs )
+ '''
+ if self.target is not None:
if len(self.args) != 0:
self.result = self.target( *self.args )
else:
self.result = self.target()
+ # FIXME: handle kwargs?
+ '''
except Exception as e:
- print "Thread-" + str(self.threadID) + \
- ":something went wrong with " + self.name + " method"
+ print "Thread-" + str( self.threadID ) + " '" + self.name + "'"\
+ ":something went wrong with " + self.target + " method"
print e
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index 70de8ec..acbc0f1 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
'''
Created on 22-Oct-2012
-
+
@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
@@ -16,7 +16,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with TestON. If not, see <http://www.gnu.org/licenses/>.
+ along with TestON. If not, see <http://www.gnu.org/licenses/>.
@@ -90,7 +90,7 @@
self.logs_path = logs_path
self.driver = ''
self.Thread = Thread
-
+
self.configparser()
verifyOptions(options)
load_logger()
@@ -99,17 +99,17 @@
self.driversList=[]
if type(self.componentDictionary) == str :
self.componentDictionary = dict(self.componentDictionary)
-
+
for component in self.componentDictionary :
self.driversList.append(self.componentDictionary[component]['type'])
-
+
self.driversList = list(set(self.driversList)) # Removing duplicates.
# Checking the test_target option set for the component or not
if type(self.componentDictionary) == dict:
for component in self.componentDictionary.keys():
if 'test_target' in self.componentDictionary[component].keys():
self.test_target = component
-
+
# Checking for the openspeak file and test script
self.logger.initlog(self)