0
def run_tasks():
    tasks = get_tasks(task_id) #task_list
    for task in tasks:
        t = threading.Thread(target=exec_task, args=(task,), name=task['id'])
        t.start()
    
def exec_task(task):
    pytest.main('-s', '-v', task['path'])

I want to run pytest main with thread in my services, but when len(tasks) > 1, the result of tasks always the task[0]. If I want run different project in parallel, what shall I do?

Michael S.
  • 3,050
  • 4
  • 19
  • 34
太大阳
  • 1
  • 1

0 Answers0