how to run pytest.main() with thread #10271
-
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? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
The outlined use case is absolutely unsupported, and won't be supported Please outline the target use case for figuring a supported way |
Beta Was this translation helpful? Give feedback.
-
The usual solution to that is to run each "project" in a separate process, usually controlled by different CI jobs. If you need to control that via a script for some reason, you should instead execute each You can accomplish this by running via |
Beta Was this translation helpful? Give feedback.
The usual solution to that is to run each "project" in a separate process, usually controlled by different CI jobs.
If you need to control that via a script for some reason, you should instead execute each
pytest.main
in its own subprocess, as this is safer.You can accomplish this by running via
subprocess.run(["pytest", ...])
or viamultiprocessing.Pool
, although I would recommend the former because I think this will carry less surprises.