Skip to content

how to run pytest.main() with thread #10271

Answered by nicoddemus
zhengjiaoyang asked this question in Q&A
Discussion options

You must be logged in to vote

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 via multiprocessing.Pool, although I would recommend the former because I think this will carry less surprises.

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
6 replies
@RonnyPfannschmidt
Comment options

@zhengjiaoyang
Comment options

@nicoddemus
Comment options

@zhengjiaoyang
Comment options

@nicoddemus
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by nicoddemus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants