While on Python the most widespread testing toolkit is pytest, some web frameworks provide their own solutions for managing test suites. Django is one such example, even though it's possible (as we have seen in the previous section), most people tend to run their tests with the Django test client, which provides the same capabilities as WebTest but is a solution built explicitly for Django.
In this section, we are going to see how we can create a Django project and then run its tests using the standard Django testing infrastructure as well as a pytest-based one:
- The first step will be to create a new Django project, which we are going to call djapp:
$ django-admin startproject djapp
This will create a djapp directory where we can manage our Django project. In the project directory, we will find a manage.py file, which allows us to run various management operations for our project, from setting up the database to starting the web...