Create a new pytest.ini
file within the games_service
folder (the same folder that has the manage.py
file). The following lines show the code that specifies the desired configuration for Pytest. The code file for the sample is included in the restful_python_2_08_02
folder, in the Django01/game_service/manage.py
file:
[pytest] DJANGO_SETTINGS_MODULE = games_service.settings python_files = tests.py test_*.py *_tests.py
The DJANGO_SETTINGS_MODULE
configuration variable specifies that we want to use the settings.py
file located in the games_service/games_service
folder as the settings module for Django when tests are executed.
The python_files
configuration variable indicates the filters that pytest
will use to find modules with test functions.