In the previous chapter, we discussed why testing is so important and looked at a brief overview of the unittest module. We also took a cursory look at pytest's features, but barely got a taste of them.
In this chapter, we will start our journey with pytest. We will be pragmatic, so this means that we will not take an exhaustive look at all of the things it's possible to do with pytest, but instead provide you with a quick overview of the basics to make you productive quickly. We will take a look at how to write tests, how to organize them into files and directories, and how to use pytest's command line effectively.
Here's what is covered in this chapter:
- Installing pytest
- Writing and running tests
- Organizing files and packages
- Useful command-line options
- Configuration: pytest.ini file
In the chapter, there are a lot of examples...