207: pytest course, pytest-repeat and pytest-flakefinder

Brian:

Okay. We're gonna talk about a whole bunch of stuff in this episode. It's kind of a catch up thing. I've been working on a video course, for Pytest. Basically, it's based on I know I already have a course that's on the talk Python training.

Brian:

It's an excellent course. You should go check it out. It's about 3 and a half hours, I think, last time I looked, and it's on the yeah. It's on talk Python training. So what's the new one about?

Brian:

The the one that's on talk Python is, like a fairly quick introduction to Pytest, but I cover a whole bunch more detail in the Pytest book. So that's what this new course is. It's the entire Python testing with Pytest 2nd edition book in, video course format. And then also when I'm recording it, sometimes there's a few things that maybe could be rearranged a little bit, and then I forgot some stuff. So there's actually more stuff.

Brian:

There's a a few extra bonuses. I'll probably include more as time goes on, with the with the book. So to check that out, the check check the course out, it's at you can go to python test.com/course, and I'll have a link in the show notes too. But, it's it's in 3 parts like the book is. There's, there's part 1, part 2, part 3.

Brian:

The part 1 is pry pytest primary power. I cover all of the foundational information around pytest. If you just and that one's complete. If you just took that even, just the part 1, you would be on really solid foundation for using pytest. Part 2 is, working with projects, and then part 3 is booster rockets.

Brian:

Working with projects is pretty fun. We do things like, incorporate code coverage and do talks and a whole bunch of goodies. The, I've started, part 2. I got the I have the testing strategy chapter up, so through chapter 7, but that's it so far, but it's gonna continue. There will be 16 chapters in total, but if you buy it now, you get all of that.

Brian:

And right now, I'm offering the I might change my mind in the future, but I might not. I'm no no promises there. But right now, you get for one price, you get, you get access to if you if you grab part 1, you get all the parts, and that's as of end of September. I'm not gonna change it in September. But when I complete the whole thing, then I'm gonna I might re rethink about the pricing model.

Brian:

But for right now, I don't wanna think about that. I just wanna think about finishing the course. But that's why I really haven't gotten a lot of podcasts out lately. But I have done some other things. I do wanna address one more thing about the course though before we move on.

Brian:

There's, there's 2 pricing models I wanted. There's a low price one that's, a lower price that is just the video course only, but I wanted to have the experience available to people if they wanted to, if it was like like I'm sitting right next to them teaching them pytest. And the problem with the video course is you can't ask questions back. But, but I so there's 2 pricing options. One of them is, just watch the video course.

Brian:

You have access to everything, and you have access to the code download. There's a community edition one that's a a little bit higher price, but it is, it's got you've got access to the GitHub repo, so you can just clone the code and you can get pull you can just, get a get pull for updates when I add new chapters. And then you have access to a Slack and a Discord and and just to be able to ask questions. So if you have any any troubles, that's there. Okay.

Brian:

Moving on. Let's talk about some of the other stuff I've been up to. I started another podcast called Python people. I'm really excited about this. It's been been fun.

Brian:

Again, I haven't slowed down on these, interviews, but, but I'm I have slowed down on actually getting them posted. So I've got a whole bunch of a backlog of Python People episodes. And what this is is really instead of trying to get details out of like, a lot of Python podcasts or tech podcasts are trying to teach you something. There's nothing wrong with that. I love those kind of podcasts, and this is one of those podcasts.

Brian:

But I also like to just get to know people. I really love the Python community. So the Python people is really about just getting to know some of the people that are involved with Python and some of the just some people that even just use it, just are users of Python, and, and then some of the core people. And you check it out. It's I think it's fun conversations.

Brian:

Sometimes for with some people, they're just comfortable with talking about the work they're doing or the projects they're working on, and that's fine. But some people are comfortable with talking about all sorts of stuff like, you know, their hobbies and whatever. So Michael Kennedy was on. We talked about motorcycles. That was fun.

Brian:

So that's Python people also. The other thing I've been working on is open source contributions. So there is, a plugin called pytestrepeat, and I, I'd like to try to help out with this project. And I have my own open source projects. Pytest check is one I started, and I've got a couple other small ones.

Brian:

The pytest check is the only one that really a lot of people use, and, but I'm the, the core maintainer for that, so I get to make up the rules. I'd like to help out with pytest repeat, but it's already been it's already been a project that other people have worked on, and it's part of the pytest dev community umbrella. And I'd like to try and I'm starting to contribute and learn all of the maintainer bits. It's a little bit different to maintain help maintain somebody a a project that somebody else started. That's a little different than maintaining your own project, and I'm enjoying learning learning the ropes there.

Brian:

And, Bruno Olivier, who goes, goes by the name of Nicodermis a lot on online stuff, he's been helping me out a lot, and I really appreciate it. And it's been a great experience so far. Anyway, now I want to talk about pytest repeat. One of the reasons why I got into it is because it looked like it hadn't been updated too much lately, but it still works fine on pytest, on Python 11 and pytest 7. It just doesn't look like it if you look at the, like, what what's being tested.

Brian:

So, I'm helping to contribute to that, and, that'll be fun. But why did I wanna try to contribute? Well, partly, it's because it hasn't been updated for a while, and I wanna I'd like to do I I started with, like, moving the, the testing, the CI background back stuff, moving that from Jenkins, or is it Jake? No. It wasn't Jenkins.

Brian:

It was, oh, I even forget without Travis. It was on Jeff Travis. That's right. Moving it from Travis to, GitHub actions because that's where I'm most familiar with. So did that already, but I haven't done a release with that yet.

Brian:

The that's the next part is to try to figure out the this whole new release process that PyPI is working with and Pytest dev projects are under. It it there's another thing also is that there's a feature of Pytest repeat that is that needs to be highlighted a little bit better because it was documented, but I didn't know about it. So what pytestrepeat does is it repeats the tests that you pointed at. So let's say you've got a a test suite of 10 tests, and you tell pytest repeat to repeat everything twice. What it'll do is it'll go to the first test and run it twice and then the second test and run that twice and so forth.

Brian:

That might be what you meant, But, usually, what I mean is I wanna run all 10 tests and then and then start over again and run the whole thing over again. Why would you do that? It's it's all often because there's something that some intermittent failure, and you wanna run the whole thing a bunch of times overnight or something. So there's another related plugin called pytest flake finder, completely different name. You got repeat in flake finder, and flake finder by default does kind of the opposite.

Brian:

Instead of repeating each test and then going on to the next one, it kind of it does all 10, so that's usually what I want it to do. But I was like, how could we add that to pytest repeat? Because pytest repeat is like the name that I'm thinking of when I wanna repeat tests. So I took a look at it, and there is oh, I'll just bring it up right now so I'm not, like, making this up. In the readme, there is the there's a title called repeating tests and talks about that, and then there's a little code sample.

Brian:

And then there's 2 paragraphs under it that say, if you want to override the default text execution order, you can use repeat scope option with one of the next values, session, module, class, or function. So if you pass in repeat scope and then the word session, it'll do exactly what I wanted it to do, which was repeat the whole thing and then start over and re like, do all 10 tests and then repeat the whole thing over again or with however many you you want. That's so cool. So, the only thing and it's even documented well. I just missed it.

Brian:

I think another heading there would be good of, like, you know, change the scope. Or I don't know what the heading would be, but I'll play with it, thinking about that. I'd like to contribute to that. So, if you wanna repeat things, right now, repeat, pytest repeat works fine, but you can do flake finer. Both of them work fine.

Brian:

I'll put links in the show notes, but try both of those. I just bring it up because I don't know why I didn't see that repeat scope before. And, I've talked with other people that have said, oh, yeah. That's what I wanted, but I didn't know that it would do that. So, if you've ever wanted to repeat stuff, do that.

Brian:

I guess what is there other stuff I wanted to talk about? I do have a a whole list of, episodes that I wanna talk discuss related to, test driven development and, lean software development, but I kinda have to develop those ideas. So I think what I'll do is do of these, like, shorter little, catch up episodes or talk about a plug in or something like that, and then, interleave those with, the longer essay ones. And as far as, interviews with other people about stuff, like, I'd like to talk about more, packaging. I'd like to to interview somebody about Hatch and Hatchling and more about Flit and talk with Brett Cannon about, you know, as things develop and all bunch of other people.

Brian:

But the interviews and stuff, they're gonna have to kinda wait until I get this Pytest course done because, I'm already doing a lot of interviews and doing Python Bytes. And it's kinda cool. I didn't even think about this until after I decided to rename testing code to Python test. So now I've got 3 podcasts. They're Python test, Python people, and Python bytes.

Brian:

So that's neat. They all match. Anyway, thanks a ton for following this podcast even though I'm not doing it as often. Thanks so much. That's it for today.

Brian:

Now go ahead and test something.

Creators and Guests

Brian Okken
Host
Brian Okken
Software Engineer, also on Python Bytes and Python People podcasts
207: pytest course, pytest-repeat and pytest-flakefinder
Broadcast by