Setting up unit tests with pytest

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.53.5