#100DaysOfCode in Python Transcripts
Chapter: Days 10-12: Testing your code with pytest
Lecture: Second day: use pytest on your code

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Welcome back to the hundred days of Python. This is day two of the pytest lesson. Yesterday, we went over quite some concepts,
0:09 and now it's time to get practical. So here, I pointed to a code challenge, which is, not surprisingly, writing tests with pytest,
0:23 and it consists of going through your code, see where tests are missing, and add them. Another option is to test a Flask API,
0:32 or even contribute to open source. There's a lot of great work being done, and not all might have test coverage.
0:39 It might be a useful way to get into those projects, to start adding tests. So basically that, if you want to follow along,
0:46 you can clone our challenges repo and make a branch and PR your work, because we're always curious to see what you come up with.
0:55 Another way, if you want to just look at some tests, is to head over to our bites. Every bite is tested with a couple of pytests,
1:03 so each bite under the tests tab shows you pytest in action. And a day generator...
1:25 And here is the exceptions being tested by pytest again. One syntax we did not see is the pytest .fail. This basically where it raises an exception
1:35 when it should not have, alright. Then I want to point you to one more resource and that's Brian Okken's Test and Code.
1:48 He has this podcast dedicated to testing in Python and he is the author of Python Testing with Pytest which is a great book.
1:59 I only showed you a couple of things. This book goes in detail on how to set up pytest configuration, fixtures, and a lot more.
2:09 So if you're serious about pytest, this is a great resource. And that's it, today is all about getting practical
2:16 and tomorrow I'll check back in with you how it is going. Good luck.


Talk Python's Mastodon Michael Kennedy's Mastodon