#100DaysOfCode in Python Transcripts
Chapter: Days 10-12: Testing your code with pytest
Lecture: Third day: writing pytest fixtures
Login or
purchase this course
to watch this video and the rest of the course contents.
0:01
Welcome back to the 100 Days of Python. Day three of pytest. And the final day where I want you to get some more exercise.
0:10
And in all honestly, I recorded this lesson and something was bugging me. Fixtures. I mean, fixtures are described as the killer feature of pytest
0:20
and I did not cover them. But no worries, you will learn them today. I made this article explaining everything you need to know
0:28
to start to use them in your test code. And okay, it's a pretty long article, but it's not too hard to actually learn and do.
0:37
There's a practical example in this article. If you read through this, then you will see that it's pretty easy to set up.
0:44
But it will make your test code a lot better. So, I ask you today to come up with a use case, so it can be to set up and tear down a database,
0:55
but it doesn't have to be a database. It can also be an object of any kind, a class, or something that requires setUp and tearDown or even only setUp.
1:04
But I really want you to try to learn this skill. As you know from unittest, setUp and tearDown are commonly used,
1:10
and pytest fixtures are the way to do that. So it's critical to understand this. That's another day of practical exercises
1:17
and I think by the end of this day, you'll have a good grasp on pytest. Which will go a long way, because as we mentioned before,
1:24
writing test is a very important skill. Good luck and let us know what you come up with. Use the #100DaysOfCode and feel to include
1:32
Talk Python or PyBites in your tweets. All right, have fun.