Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Parallel.py refactoring.

  • Loading branch information...
commit c6d09fff891f930ae067fcbc70aa6140224ee95d 1 parent ddf190a
@OniOni authored
Showing with 5 additions and 9 deletions.
  1. +5 −9 wd/parallel.py
View
14 wd/parallel.py
@@ -62,7 +62,6 @@ def register(self, wd):
self._drivers = [wd]
-
def multiply(test):
"""Make test run in mutiple browsers
"""
@@ -72,17 +71,16 @@ def __init__(self, driver=None):
self.driver = driver
self.driver.implicitly_wait(30)
+
def thread_func(f, driver=None, queue=None):
try:
f(SubTest(driver))
except Exception as e:
print e
-
def wrapper(*args, **kwargs):
threads = []
queue = multiprocessing.Queue(len(args[0].drivers._desired_capabilities) + 1)
- pool = multiprocessing.Pool(processes=4)
i = 0
if not hasattr(args[0].drivers, "_drivers"):
@@ -95,15 +93,13 @@ def wrapper(*args, **kwargs):
driver = webdriver.Remote(**kwargs)
args[0].drivers.register(driver)
-
for d in args[0].drivers._drivers:
- t = multiprocessing.Process(target=thread_func, args=(test,), kwargs={'driver': d})
- t.start()
- threads += [t]
- i += 1
+ t = multiprocessing.Process(target=thread_func, args=(test, d))
+ t.start()
+ threads += [t]
for t in threads:
t.join()
- i -= 1
+
return wrapper
Please sign in to comment.
Something went wrong with that request. Please try again.