Getting started with pytest Transcripts
Chapter: pytest Plugins
Lecture: Running tests in parallel with pytest-xdist
0:00 So maybe we want to run this like 10 times and our tolerance is okay for a quarter second test. But what if it's really a lot slower?
0:10 So let's let's make it more annoying and just have it be an entire second and instead of 10, let's do six times. So if we do that six times,
0:20 it's about 2345, 6....6 seconds. A little over six seconds to speed this up. Let's run these in parallel by using the pytest. xdist plugin. So pip,
0:34 install pytest xdist and now we run the same thing, but we'll give it a -n equals auto, see how fast we can do it.
0:50 It was like a little over six seconds before, so it ran in about two seconds. A little over two seconds. Did we do six?
0:59 Let's if we did like, so it was six seconds for six. If we did two processes, we would expect it to be about three seconds.
1:09 Right? And it is a little it's a little over three seconds. So there's a little overhead with the xdist.
1:19 So I really want to make sure that it's useful for you before you go ahead and get started with it but running things in parallel will be very handy.