Getting started with pytest Transcripts
Chapter: pytest Plugins
Lecture: Finding plugins
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
There are a lot of places where you can go find pytest plugins. One place is directly at pytest.org and if you go just to the
0:09
home page there is a reference guide called pytest plugin list. And the plug in list contains over 1000 plug ins and it pulls them directly from
0:18
pypi. So you can take a look through here. You can also you can also search of course because it's a big page.
0:25
We can also go to pypi as you we can search for pytest stuff here too. But it's a big list here. It's anything that actually even references pytest.
0:34
So this is a lot a good place to start is well supported pytest plug ins
0:39
usually will select the framework pytest classifier if they're publishing it well. And this limits it a little bit.
0:48
And we can also look for things like if we look for Django for example,
0:53
that a list of 50 projects for Django with the pytest framework classifier for instance here's a pytest Django ordering pytest,
1:04
plugin for preserving the order in which Django runs tests. So this is kind of neat also like that there's an order by so you can
1:11
order by relevance or date last updated, not sure what trending means, but whatever we can go to the github
1:21
pytest dev group, This is the group that supports pytests itself, but it also supports quite a few pytest plugins.
1:30
Well, it doesn't really support them directly, but it is a plugin author can request to be included in here,
1:37
and this allows for more help but doesn't guarantee help, but it allows for it. So this is pretty cool.
1:43
The three that I want to demonstrate in this course are pytest repeat,
1:47
which allows us to repeat a single test or multiple tests a specific number of times
1:52
It adds this. This extra command and allows us to run something multiple times
1:58
pretty handy randomly allows us to randomize the order of our test runs to make sure
2:05
that they're not order dependent. But it also seeds random tools such as faker, Numpy such and then Xdist is used.
2:14
I use it to run tests in parallel but you can also distribute across different test nodes, which is pretty neat and it adds the dash and flag.
2:22
You can give it auto for it to just select, which is nice how many processes to run on? So we will try all those of it.