Now, go to the restful01
folder that contains the manage.py
file, with the virtual environment activated, and run the following command:
pytest
The pytest
command and the Django REST framework will perform the following actions:
- Create a clean test database name
test_drones
. - Run all the migrations required for the database.
- Discover the tests that have to be executed based on the settings specified in the
pytest.ini
file. - Run all the methods whose name starts with the
test_
prefix in theDroneCategoryTests
class and display the results. We declared this class in thetests.py
file and it matches the pattern specified for thepython_files
setting in thepytest.ini
file. - Drop the test database named
test_drones
.