Learning Resources for pytest
In this blog post, we’ll look at how PyCharm helps you when you’re working with pytest, and we will signpost you to a bunch of resources for learning pytest. While some of these resources were created by us here at JetBrains, others were crafted by the storytellers in the pytest community.
Using pytest in PyCharm
PyCharm has extensive support for pytest, including a dedicated test pytest runner. PyCharm also gives you code completion for the test subject and pytest fixtures as detailed assert failure reports so you can get to the root of the problem quickly.
Resources for pytest
If you like reading blog posts, we have plenty of those. If videos are more your thing, we have some awesome content there, too. If you prefer a sequential course, we have some pointers for you, and if you prefer to snuggle down and read a book, we’ve got a great recommendation as well. There’s a little something here for everyone!
Although the majority of these resources don’t assume any prior knowledge of pytest, some delve deeper into the subject than others – so there’s plenty to explore when you’re ready.
First, let me point you to two important links:
- The pytest page on the JetBrains Guide serves as a starting point for all the pytest resources we’ve created.
- Brian Okken maintains a website for all his pytest resources (some of which are free, whereas others are paid).
Videos about pytest
We have a video tutorial series composed of nine videos on pytest that start from the beginning of pytest-time. You can check out the tutorials on YouTube.
If there’s something specific you want to take a look at, the individual video topics are:
- Background
- Setup
- First Test
- Test-Driven Development
- Finding and Fixing Errors
- Skipping Tests
- Using Fixtures
- Debugging Tests
- Testing for Exceptions
If you want a super-speedy refresher of pytest in PyCharm, you can watch PyCharm and pytest in Under 7 Minutes (beware – it’s fast!)
Tutorials about pytest
If you prefer learning by doing, we have some great pytest tutorials for you. First, the above video series is also available as a written tutorial in the JetBrains Guide.
Alternatively, Brian Okken has produced a detailed tutorial on everything pytest if you want to explore all areas. This tutorial is paid content, but it’s well worth it!
Books about pytest
If you prefer reading, we have lots of blog posts for you. Here are some of the pytest resources on the JetBrains Guide:
- An Interview with Brian Okken
- Three pytest Features You Will Love
- pytest vs. unittest: Which Is Better
- Do You Do Enough Testing? pytest to the Rescue!
Additionally, Brian has a blog that covers a diverse range of pytest subjects you can dive into.
While we’re on the subject of reading, Brian has also written an excellent book on pytest that you can purchase and curl up with if that’s your thing.
Official pytest documentation
Last but not least, the official pytest documentation is another one to bookmark and keep close by as you go on your journey to pytest mastery.
Conclusion
The Python testing framework pytest is packed with helpful features such as fixtures, mocking, and parametrizing that make testing your applications easier, giving you confidence in the quality of your code. Go ahead and try pytest out and let us know what you learn on your path to Python testing excellence!