Commit b1b56d97 authored by U. Artie Eoff's avatar U. Artie Eoff Committed by Chad Versace
Browse files

Modify the Test class in core.py to use ThreadPools.

Modify Test class to use ThreadPools in its doRun method.  All
tests now execute in the default ThreadPool named 'base'.
A Test instance can be configured to run in a different (named)
ThreadPool instance by setting its poolName member variable to
that name.
parent 05a710bc
......@@ -33,6 +33,8 @@ import time
import traceback
from log import log
from cStringIO import StringIO
from threads import ThreadPools
import threading
__all__ = [
'Environment',
......@@ -289,13 +291,18 @@ class Test:
ignoreErrors = []
sleep = 0
def __init__(self):
pass
def __init__(self, poolName = "base"):
self.poolName = poolName
def run(self):
raise NotImplementedError
def doRun(self, env, path):
if ThreadPools().lookup(self.poolName) is None:
ThreadPools().create(self.poolName)
ThreadPools().put(self.__doRunWork, args = (env, path,), name = self.poolName)
def __doRunWork(self, env, path):
# Exclude tests that don't match the filter regexp
if len(env.filter) > 0:
if not True in map(lambda f: f.search(path) != None, env.filter):
......@@ -380,6 +387,7 @@ class TestProfile:
def run(self, env):
time_start = time.time()
self.tests.doRun(env, '')
ThreadPools().joinAll()
time_end = time.time()
print >>env.file, "time:",(time_end-time_start)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment