Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 20990

Starting threads in python!?

$
0
0

  Hi,

 

Have anyone used pythons threading.Thread and Queue in TestComplete?

 

I can not get it to work, test runner hangs on Thread.start()

 

Here is an example of what I'm trying to accomplish

def ForEachInParallell(items, func, args, num_worker_threads=8):

  def worker(args):
    while True:
      i = q.get()
      func(i)
      q.task_done()

  q = Queue()

  for n in range(min(max(4, num_worker_threads), 16)):
    t = Thread(target=worker, kwargs=args)
    t.daemon = True
    t.start()  # here the debugger hangs

  for item in items:
    q.put(item)

  q.join()

After it hangs I have to kill TestComplete and restart...

  BR, Johan


Viewing all articles
Browse latest Browse all 20990

Trending Articles