Skip to Content
Hands-On RESTful Python Web Services - Second Edition
book

Hands-On RESTful Python Web Services - Second Edition

by Gastón C. Hillar
December 2018
Intermediate to advanced
500 pages
12h 33m
English
Packt Publishing
Content preview from Hands-On RESTful Python Web Services - Second Edition

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Building RESTful Python Web Services

Building RESTful Python Web Services

Gastón C. Hillar
Python Command Line Tools

Python Command Line Tools

Alfredo Deza, Noah Gift

Publisher Resources

ISBN: 9781789532227Supplemental Content